diff --git a/extras/build_rpm_rhel7.sh b/extras/build_rpm_rhel7.sh index 6bb65d816d..3684bd42e5 100755 --- a/extras/build_rpm_rhel7.sh +++ b/extras/build_rpm_rhel7.sh @@ -11,16 +11,16 @@ echo "Creating RPM packages in $RPMHOME/RPMS" rpmbuild -ba $CODEHOME/pandora_console/pandora_console.rhel7.spec || exit 1 # Server -rpmbuild -ba $CODEHOME/pandora_server/pandora_server.rhel7.spec || exit 1 +#rpmbuild -ba $CODEHOME/pandora_server/pandora_server.rhel7.spec || exit 1 # Unix agent -rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.rhel7.spec || exit 1 +#rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.rhel7.spec || exit 1 # Enterprise console rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec || exit 1 # Enterprise server -rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.rhel7.spec || exit 1 +#rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.rhel7.spec || exit 1 exit 0 diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 33e0c891f7..edab1affeb 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -30,6 +30,7 @@ $CODEHOME/pandora_console/pandora_console.rhel7.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \ +$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec" DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \ $CODEHOME/pandora_server/DEBIAN \ diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index c5a79a38b5..f5e67c98ba 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, AIX version +# Version 7.0NG.734, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index da15c864ea..74b075e83d 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, FreeBSD Version +# Version 7.0NG.734, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index cb8075b7ac..10d360a51d 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, HP-UX Version +# Version 7.0NG.734, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 170e9c6ccf..9ad57d9a9d 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, GNU/Linux +# Version 7.0NG.734, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 42257021fa..360efd4d9b 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, GNU/Linux +# Version 7.0NG.734, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index ebad34a0ab..f0a8d0c0ef 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, Solaris Version +# Version 7.0NG.734, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 972f6d8aa1..d01ed9068f 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2010 Artica Soluciones Tecnologicas -# Version 7.0NG.733 +# Version 7.0NG.734 # 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 diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 6a80829c29..0e0546261d 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.733, AIX version +# Version 7.0NG.734, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index 6555df787c..a941a9671e 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.733 +# Version 7.0NG.734 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index ba29482633..779ef59e37 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.733, HPUX Version +# Version 7.0NG.734, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 7bd41ad039..07869dd19b 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733 +# Version 7.0NG.734 # Licensed under GPL license v2, # (c) 2003-2010 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index 525f70c2af..0d1a1928c3 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733 +# Version 7.0NG.734 # Licensed under GPL license v2, # (c) 2003-2009 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index d3cf26efa2..2eb1b43e76 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733 +# Version 7.0NG.734 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index 5a94defce2..2928f1d320 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.733, Solaris version +# Version 7.0NG.734, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index ac43dfdabb..7c363219a1 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, AIX version +# Version 7.0NG.734, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index ae32bb637c..9a5a5c13bf 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190412 +Version: 7.0NG.734 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index dfaee640cd..517c4591ce 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.733-190412" +pandora_version="7.0NG.734" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 3b87b2bdbf..5c5ebf5808 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, GNU/Linux +# Version 7.0NG.734, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 55e5ab3dd0..5fc956c564 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, FreeBSD Version +# Version 7.0NG.734, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 3c9891fdce..b5bce38619 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, HP-UX Version +# Version 7.0NG.734, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 0f6cbfc83a..f0e610c8a3 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, GNU/Linux +# Version 7.0NG.734, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index 11e8c8e6c0..6599a01803 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, GNU/Linux +# Version 7.0NG.734, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index d0e7f040e2..a9cd29af83 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, NetBSD Version +# Version 7.0NG.734, NetBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index bb270634a5..8b1151bbad 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.733, Solaris Version +# Version 7.0NG.734, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8574e5992c..b3e3089317 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,8 +41,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190412'; +use constant AGENT_VERSION => '7.0NG.734'; +use constant AGENT_BUILD => '190424'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1075,6 +1075,10 @@ sub send_buffered_xml_files ($;$) { unlink ("$temporal_file/$xml_file"); } } + # Do not get stuck trying to send buffered XML files to a secondary server. + elsif ($flag_always == 2) { + last; + } } if (defined($flag_always) && ($flag_always == 2)){ swap_servers (); diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index f422cf9440..3c184a9883 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.733 -%define release 190412 +%define version 7.0NG.734 +%define release 1 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index aa20c8959d..dee0a6cc7f 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.733 -%define release 190412 +%define version 7.0NG.734 +%define release 1 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 5a37ec8afb..9244963760 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -9,8 +9,8 @@ # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.733" -PI_BUILD="190412" +PI_VERSION="7.0NG.734" +PI_BUILD="190424" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 3ec2bf3880..0f6d503674 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.733 +# Version 7.0NG.734 # 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 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ab6dbf55cf..3ce43f001f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -3,7 +3,7 @@ AllowLanguageSelection {Yes} AppName -{Pandora FMS Windows Agent v7.0NG.733} +{Pandora FMS Windows Agent v7.0NG.734} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190412} +{190424} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-<%Version%>-Setup<%Ext%>} +{<%AppName%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 29e3fa7c6c..e7db264363 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.733(Build 190412)") +#define PANDORA_VERSION ("7.0NG.734(Build 190424)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index f100c45e66..86881fe134 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.733(Build 190412))" + VALUE "ProductVersion", "(7.0NG.734(Build 190424))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9a2377396a..0a06edb215 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190412 +Version: 7.0NG.734 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 8ede0c1194..e07fdab126 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.733-190412" +pandora_version="7.0NG.734" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 46272504f6..72b90eeafa 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -378,7 +378,8 @@ function mainAgentsAlerts() 'alerts_agents' ); - echo ''; + echo '
'; + echo ''; echo "'; if ($hor_offset > 0) { @@ -421,9 +422,10 @@ function mainAgentsAlerts() continue; } - echo ''; + echo ''; } + echo ''; if (($hor_offset + $block) < $ntemplates) { $new_hor_offset = ($hor_offset + $block); echo "
".__('Agents').' / '.__('Alert templates').''.io_safe_output($tname).html_print_image('images/information_alerts.png', true, ['title' => io_safe_output($tname), 'style' => 'margin-left:5px' ]).''.io_safe_output($tname).'
@@ -455,7 +457,7 @@ function mainAgentsAlerts() $cellstyle = 'background:'.COL_ALERTFIRED.';'; } - echo ' '; + echo ' '; $uniqid = uniqid(); echo '
'; @@ -478,6 +480,23 @@ function mainAgentsAlerts() } echo '
'; + + ui_pagination( + $nagents, + false, + 0, + 0, + false, + 'offset', + true, + 'pagination-bottom', + '', + [ + 'count' => '', + 'offset' => 'offset_param', + ], + 'alerts_agents' + ); } } @@ -487,7 +506,7 @@ function mainAgentsAlerts() function print_alerts_summary_modal_window($id, $alerts) { $table->width = '98%'; - $table->class = 'databox'; + $table->class = 'info_table'; $table->data = []; $table->head[0] = __('Module'); diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 2aface6996..546ee463fa 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -148,7 +148,7 @@ function dbmgr_extension_main() echo "
"; $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->head = array_keys($result[0]); $table->data = $result; diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 1d01cd1418..80de4563ae 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -45,11 +45,9 @@ if (!empty($files)) { $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->style = []; $table->style[1] = 'max-width: 200px;'; - $table->style[2] = 'text-align: center;'; - $table->style[3] = 'text-align: center;'; $table->style[4] = 'text-align: center;'; $table->head = []; $table->head[0] = __('Name'); @@ -81,6 +79,7 @@ if (!empty($files)) { // Last modification // Public URL $data[4] = ''; + $table->cellclass[][4] = 'action_buttons'; if (!empty($file['hash'])) { $public_url = ui_get_full_url(EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']); $message = __('Copy to clipboard').': Ctrl+C -> Enter'; @@ -92,7 +91,7 @@ if (!empty($files)) { } $data[4] .= ""; - $data[4] .= html_print_image('images/download.png', true, ['title' => __('Download')]); + $data[4] .= html_print_image('images/download.png', true, ['title' => __('Download'), 'style' => 'padding:3px' ]); // Download image $data[4] .= ''; diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 562d757a20..e26b0dab1e 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -66,10 +66,10 @@ function users_extension_main_god($god=true) $rows = []; echo "
".__('No other users connected').'
'; } else { - $table->cellpadding = 4; - $table->cellspacing = 4; + $table->cellpadding = 0; + $table->cellspacing = 0; $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->size = []; $table->data = []; $table->head = []; diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql index 729d63c884..697be21a93 100644 --- a/pandora_console/extras/mr/27.sql +++ b/pandora_console/extras/mr/27.sql @@ -1,5 +1,7 @@ START TRANSACTION; +ALTER TABLE `tnetflow_filter` DROP COLUMN `output`; + ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; @@ -37,4 +39,16 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; -COMMIT; \ No newline at end of file +ALTER TABLE `trecon_script` ADD COLUMN `type` int NOT NULL default 0; +ALTER TABLE `trecon_task` ADD COLUMN `type` int NOT NULL default 0; + +UPDATE `trecon_script` SET `type` = 1 WHERE `name`="Discovery.Application.VMware"; +UPDATE `trecon_script` SET `type` = 2 WHERE `name`="Discovery.Cloud"; +UPDATE `trecon_script` SET `type` = 3 WHERE `name` LIKE "IPAM%Recon"; +UPDATE `trecon_script` SET `type` = 4 WHERE `name` LIKE "IPMI%Recon"; + +UPDATE `trecon_task` SET `type`=3 WHERE `description`="Discovery.Application.VMware"; +UPDATE `trecon_task` SET `type`=2 WHERE `description`="Discovery.Cloud"; +UPDATE `trecon_task` SET `type`=7 WHERE `description`="Discovery.Cloud.RDS"; + +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 74f12fcf2f..4cdb88ac30 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -2093,6 +2093,12 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di -- ---------------------------------------------------------------------- ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; +-- ---------------------------------------------------------------------- +-- Add column in table `tnetflow_filter` +-- ---------------------------------------------------------------------- +ALTER TABLE `tnetflow_filter` DROP COLUMN `output`; + + -- ---------------------------------------------------------------------- -- Update table `tuser_task` -- ---------------------------------------------------------------------- diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index d3bf94ddc1..3117ddb490 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -284,7 +284,7 @@ if ($config['menu_type'] == 'classic') { $header_support .= '
'; // Documentation. - $header_docu = '
'; + $header_docu = '
'; $header_docu .= ''; $header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']); $header_docu .= '
'; diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index a267e36b4d..6ecefbf3ac 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -272,7 +272,9 @@ if (!empty($all_data)) { echo '
'; $table = new stdClass(); - $table->class = 'databox data'; + $table->class = 'info_table'; + $table->cellpadding = 0; + $table->cellspacing = 0; $table->width = '100%'; // Don't specify px. $table->data = []; diff --git a/pandora_console/general/noaccess.php b/pandora_console/general/noaccess.php index 6f6fb7a6a8..8f70661296 100644 --- a/pandora_console/general/noaccess.php +++ b/pandora_console/general/noaccess.php @@ -4,29 +4,35 @@ -
- -
- - - - images/icono_cerrar.png'> - +
+ +
+ images/input_cross.png'> +
+ +
+
+ +
+ +
+
'; + echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name()); + ?> + +
+ +
+ OK +
+
- -
- images/access_denied.png'> -
-
'; - echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name()); - ?> - -
- - -
- -
-OK -
- -
- -
+ +
\ No newline at end of file diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 93c668f00c..67a933d8cb 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -183,10 +183,10 @@ if (empty($result)) { } $table = new stdClass(); -$table->cellpadding = 4; -$table->cellspacing = 4; +$table->cellpadding = 0; +$table->cellspacing = 0; $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->size = []; $table->data = []; $table->head = []; @@ -246,7 +246,18 @@ foreach ($result as $row) { } } +foreach ($table->rowclass as $key => $value) { + if (strpos($value, 'limit_scroll') !== false) { + $table->colspan[$key] = [7]; + } else { + if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->cellclass[$key][6] = 'action_buttons'; + } + } +} + html_print_table($table); +ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { enterprise_hook('enterpriseAuditFooter'); diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index f4c93bb9f1..d71249299c 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -225,7 +225,7 @@ if ($result === false) { $table->width = '100%'; $table->cellpadding = 0; $table->cellspacing = 0; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->head = []; $table->data = []; $table->align = []; @@ -253,9 +253,9 @@ foreach ($result as $row) { $data[2] = mb_substr($row['descripcion'], 0, 60); - $data[3] = ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'  '; - - $data[3] .= '  '.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).''; + $table->cellclass[][3] = 'action_buttons'; + $data[3] = ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).''; + $data[3] .= ''.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).''; array_push($table->data, $data); } diff --git a/pandora_console/godmode/agentes/fields_manager.php b/pandora_console/godmode/agentes/fields_manager.php index 0be7166062..20a9db547a 100644 --- a/pandora_console/godmode/agentes/fields_manager.php +++ b/pandora_console/godmode/agentes/fields_manager.php @@ -97,11 +97,22 @@ if ($delete_field) { } } -$fields = db_get_all_fields_in_table('tagent_custom_fields'); +// Prepare pagination. +$offset = (int) get_parameter('offset'); +$limit = $config['block_size']; +$count_fields = db_get_value('count(*)', 'tagent_custom_fields'); + +$fields = db_get_all_rows_filter( + 'tagent_custom_fields', + [ + 'limit' => $limit, + 'offset' => $offset, + ] +); $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; if ($fields) { $table->head = []; $table->head[0] = __('ID'); @@ -135,14 +146,17 @@ foreach ($fields as $field) { $data[2] = html_print_image('images/icono_stop.png', true, ['style' => 'width:21px;height:21px;']); } + $table->cellclass[][3] = 'action_buttons'; $data[3] = ''.html_print_image('images/config.png', true, ['alt' => __('Edit'), 'title' => __('Edit'), 'border' => '0']).''; - $data[3] .= '  '.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0']).''; + $data[3] .= ''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0']).''; array_push($table->data, $data); } if ($fields) { + ui_pagination($count_fields, false, $offset); html_print_table($table); + ui_pagination($count_fields, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); } echo '
'; diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4673bf2f46..902d074f21 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -224,13 +224,13 @@ switch ($config['dbtype']) { break; } -$selected = 'border: 1px solid black;'; -$selectNameUp = ''; -$selectNameDown = ''; -$selectOsUp = ''; -$selectOsDown = ''; -$selectGroupUp = ''; -$selectGroupDown = ''; +$selected = true; +$selectNameUp = false; +$selectNameDown = false; +$selectOsUp = false; +$selectOsDown = false; +$selectGroupUp = false; +$selectGroupDown = false; switch ($sortField) { case 'remote': switch ($sort) { @@ -441,18 +441,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) { ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); if ($agents !== false) { - echo ""; - echo ''; - echo "'; - echo ''; + // Urls to sort the table. + $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled'; + $url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled'; + $url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled'; + $url_down_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled'; + $url_up_os = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled'; + $url_down_os = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled'; + $url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled'; + $url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled'; + + + echo "
'.__('Agent name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; - echo '".__('R').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectRemoteUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectRemoteDown]).''; - echo ''.__('OS').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).''; - echo '
"; + echo ''; + echo ''; + echo "'; + echo ''; echo ''; - echo ''; + echo ''; echo ''; echo "'; + echo ''; $color = 1; $rowPair = true; @@ -628,7 +637,7 @@ if ($agents !== false) { $offsetArg = $offset; } - echo "
'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).'".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).''.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).''.__('Type').''.__('Group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).''; - echo ''.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).''.__('Description').'".__('Actions').'
"; + echo ""; if ($agent['disabled']) { echo "'; - ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); + ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom'); echo "
"; } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 9df6860591..6ad5267c0e 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -358,17 +358,17 @@ if ($multiple_delete) { // TABLE LIST MODULES // ================== $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente; -$selectNameUp = ''; -$selectNameDown = ''; -$selectServerUp = ''; -$selectServerDown = ''; -$selectTypeUp = ''; -$selectTypeDown = ''; -$selectIntervalUp = ''; -$selectIntervalDown = ''; +$selectNameUp = false; +$selectNameDown = false; +$selectServerUp = false; +$selectServerDown = false; +$selectTypeUp = false; +$selectTypeDown = false; +$selectIntervalUp = false; +$selectIntervalDown = false; $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); -$selected = ''; +$selected = true; $order[] = [ 'field' => 'tmodule_group.name', @@ -482,13 +482,13 @@ switch ($sortField) { default: $selectNameUp = $selected; - $selectNameDown = ''; - $selectServerUp = ''; - $selectServerDown = ''; - $selectTypeUp = ''; - $selectTypeDown = ''; - $selectIntervalUp = ''; - $selectIntervalDown = ''; + $selectNameDown = false; + $selectServerUp = false; + $selectServerDown = false; + $selectTypeUp = false; + $selectTypeDown = false; + $selectIntervalUp = false; + $selectIntervalDown = false; switch ($config['dbtype']) { case 'mysql': case 'postgresql': @@ -626,32 +626,39 @@ if ($paginate_module) { ui_pagination($total_modules, $url); } +$url_name = $url.'&sort_field=name&sort='; +$url_server = $url.'&sort_field=server&sort='; +$url_type = $url.'&sort_field=type&sort='; +$url_interval = $url.'&sort_field=interval&sort='; + $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->head = []; -$table->head[0] = __('Name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; +$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false); +$table->head[0] = __('Name').ui_get_sorting_arrows($url_name.'up', $url_name.'down', $selectNameUp, $selectNameDown); // The access to the policy is granted only with AW permission if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) { $table->head[1] = "".__('P.').''; } -$table->head[2] = "".__('S.').''.' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectServerUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectServerDown]).''; -$table->head[3] = __('Type').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectTypeUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectTypeDown]).''; -$table->head[4] = __('Interval').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).''; +$table->head[2] = "".__('S.').''.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown); +$table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown); +$table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown); $table->head[5] = __('Description'); $table->head[6] = __('Status'); $table->head[7] = __('Warn'); $table->head[8] = __('Action'); -$table->head[9] = ''.__('Del.').''.html_print_checkbox('all_delete', 0, false, true, false); +$table->head[9] = ''.__('Del.').''; $table->rowstyle = []; $table->style = []; $table->style[0] = 'font-weight: bold'; $table->size = []; +$table->size['checkbox'] = '20px'; $table->size[2] = '70px'; $table->align = []; $table->align[2] = 'left'; @@ -706,15 +713,19 @@ foreach ($modules as $module) { $table->rowstyle[($i - 1)] = 'text-align: center'; $table->rowclass[($i - 1)] = 'datos3'; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { - $table->colspan[($i - 1)][0] = 10; + $table->colspan[($i - 1)][0] = 11; } else { - $table->colspan[($i - 1)][0] = 9; + $table->colspan[($i - 1)][0] = 10; } $data = []; } } + if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { + $data['checkbox'] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true); + } + $data[0] = ''; if (isset($module['deep']) && ($module['deep'] != 0)) { @@ -858,7 +869,7 @@ foreach ($modules as $module) { } if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && $module['id_tipo_modulo'] != 25) { - $data[8] .= ' '; $data[8] .= html_print_image( 'images/copy.png', @@ -870,7 +881,7 @@ foreach ($modules as $module) { // Make a data normalization if (isset($numericModules[$type])) { if ($numericModules[$type] === true) { - $data[8] .= ' '; + $data[8] .= ''; $data[8] .= html_print_image( 'images/chart_curve.png', true, @@ -879,18 +890,19 @@ foreach ($modules as $module) { $data[8] .= ''; } } else { - $data[8] .= ' '.html_print_image( + $data[8] .= html_print_image( 'images/chart_curve.disabled.png', true, ['title' => __('Normalize (Disabled)')] ); + $data[8] .= '  '; } // create network component action if ((is_user_admin($config['id_user'])) && ($module['id_modulo'] == MODULE_NETWORK) ) { - $data[8] .= ' '; $data[8] .= html_print_image( 'images/network.png', @@ -899,11 +911,12 @@ foreach ($modules as $module) { ); $data[8] .= ' '; } else { - $data[8] .= ' '.html_print_image( + $data[8] .= html_print_image( 'images/network.disabled.png', true, ['title' => __('Create network component (Disabled)')] ); + $data[8] .= '  '; } } @@ -917,10 +930,17 @@ foreach ($modules as $module) { ['title' => __('Delete')] ); $data[9] .= ' '; - $data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true); } + $table->cellclass[] = [ + 8 => 'action_buttons', + 9 => 'action_buttons', + ]; array_push($table->data, $data); + $table->cellclass[] = [ + 8 => 'action_buttons', + 9 => 'action_buttons', + ]; } if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 790944b472..a9529248b0 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -393,7 +393,7 @@ else { // View available downtimes present in database (if any of them) $table = new StdClass(); - $table->class = 'databox data'; + $table->class = 'info_table'; $table->width = '100%'; $table->cellstyle = []; @@ -518,9 +518,9 @@ else { } html_print_table($table); + 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 '
'; - echo '
'; // CSV export button echo '
'; html_print_button( diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 6140d5407a..0de86bf070 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -221,7 +221,7 @@ if ($delete_action) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->data = []; $table->head = []; $table->head[0] = __('Name'); @@ -281,6 +281,10 @@ foreach ($actions as $action) { } if (check_acl($config['id_user'], $action['id_group'], 'LM')) { + $table->cellclass[] = [ + 2 => 'action_buttons', + 3 => 'action_buttons', + ]; $data[2] = ''.html_print_image('images/copy.png', true).''; $data[3] = 'width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->data = []; $table->head = []; @@ -431,6 +431,7 @@ foreach ($commands as $command) { io_safe_output($command['description']) ); $data['action'] = ''; + $table->cellclass[]['action'] = 'action_buttons'; if (! $command['internal']) { $data['action'] = ''; $data['action'] .= ' 'agent_name', 'order' => 'ASC', @@ -360,12 +361,12 @@ switch ($sortField) { $selectDisabledDown = ''; $selectStandbyUp = ''; $selectStandbyDown = ''; - $selectAgentUp = ''; - $selectAgentDown = ''; + $selectAgentUp = false; + $selectAgentDown = false; $selectModuleUp = $selected; - $selectModuleDown = ''; - $selectTemplateUp = ''; - $selectTemplateDown = ''; + $selectModuleDown = false; + $selectTemplateUp = false; + $selectTemplateDown = false; $order = [ 'field' => 'agent_module_name', 'order' => 'ASC', @@ -402,12 +403,21 @@ if (!$id_agente) { $url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params; } +// Urls to sort the table. +$url_up_agente = $url.'&sort_field=agent&sort=up&pure='.$pure; +$url_down_agente = $url.'&sort_field=agent&sort=down&pure='.$pure; +$url_up_module = $url.'&sort_field=module&sort=up&pure='.$pure; +$url_down_module = $url.'&sort_field=module&sort=down&pure='.$pure; +$url_up_template = $url.'&sort_field=template&sort=up&pure='.$pure; +$url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure; + + $table = new stdClass(); if (is_metaconsole()) { $table->class = 'alert_list databox'; } else { - $table->class = 'databox data'; + $table->class = 'info_table'; } $table->width = '100%'; @@ -427,7 +437,7 @@ $table->head = []; if (! $id_agente) { $table->style = []; $table->style[0] = 'font-weight: bold;'; - $table->head[0] = __('Agent').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectAgentUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectAgentDown]).''; + $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); $table->size[0] = '4%'; $table->size[1] = '8%'; $table->size[2] = '8%'; @@ -439,7 +449,7 @@ if (! $id_agente) { $table->size[4] = '8%'; }*/ } else { - $table->head[0] = __('Module').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectModuleUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectModuleDown]).''; + $table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); // Different sizes or the layout screws up $table->size[0] = '0%'; $table->size[1] = '10%'; @@ -452,7 +462,7 @@ if (! $id_agente) { $table->size[4] = '1%'; } -$table->head[1] = __('Template').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectTemplateUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectTemplateDown]).''; +$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); $table->head[2] = __('Actions'); $table->head[3] = __('Status'); $table->head[4] = "".__('Op.').''; @@ -728,6 +738,10 @@ foreach ($simple_alerts as $alert) { $data[3] = ui_print_status_image($status, $title, true); + $table->cellclass[] = [ + 3 => 'action_buttons', + 4 => 'action_buttons', + ]; $data[4] = ''; if ($alert['disabled']) { $data[4] .= html_print_input_image('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true); @@ -742,7 +756,7 @@ foreach ($simple_alerts as $alert) { // To manage alert is necessary LW permissions in the agent group if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - $data[4] .= '  '; + $data[4] .= ''; if (!$alert['standby']) { $data[4] .= html_print_input_image('standby_off', 'images/bell.png', 1, 'padding:0px;', true); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true); @@ -771,7 +785,7 @@ foreach ($simple_alerts as $alert) { // To manage alert is necessary LW permissions in the agent group if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - $data[4] .= '  '; + $data[4] .= ''; $is_cluster = (bool) get_parameter('id_cluster'); if (!$is_cluster) { if ($alert['disabled']) { @@ -815,6 +829,11 @@ foreach ($simple_alerts as $alert) { if (isset($data)) { html_print_table($table); + if ($id_agente) { + ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); + } else { + ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); + } } else { ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]); } diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index f00dbe5827..4542169cf3 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -339,7 +339,7 @@ if ($templates === false) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->data = []; $table->head = []; $table->head[0] = __('Name'); @@ -375,6 +375,7 @@ foreach ($templates as $template) { $data[3] = alerts_get_alert_templates_type_name($template['type']); if (check_acl($config['id_user'], $template['id_group'], 'LM')) { + $table->cellclass[][4] = 'action_buttons'; $data[4] = ''; $data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true); @@ -396,6 +397,7 @@ foreach ($templates as $template) { ui_pagination($total_templates, $url); if (isset($data)) { html_print_table($table); + ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); } else { ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]); } diff --git a/pandora_console/godmode/category/category.php b/pandora_console/godmode/category/category.php index 727be02057..e1a61a4db6 100755 --- a/pandora_console/godmode/category/category.php +++ b/pandora_console/godmode/category/category.php @@ -82,7 +82,13 @@ $filter['limit'] = (int) $config['block_size']; // Search action: This will filter the display category view $result = false; -$result = categories_get_all_categories(); +$result = db_get_all_rows_filter( + 'tcategory', + [ + 'limit' => $filter['limit'], + 'offset' => $filter['offset'], + ] +); // Display categories previously filtered or not $rowPair = true; @@ -94,7 +100,7 @@ if (!empty($result)) { $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->data = []; $table->head = []; @@ -123,7 +129,8 @@ if (!empty($result)) { $data[1] .= ''.html_print_image('images/cross.png', true, ['title' => 'Delete']).''; } else { $data[0] = "".$category['name'].''; - $data[1] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).'  '; + $table->cellclass[][1] = 'action_buttons'; + $data[1] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).''; $data[1] .= ''.html_print_image('images/cross.png', true, ['title' => 'Delete']).''; } @@ -131,6 +138,7 @@ if (!empty($result)) { } html_print_table($table); + ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom'); } else { // No categories available or selected ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]); diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index 40d60650f6..60ba973996 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -113,31 +113,33 @@ if ($filters === false) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->head = []; -$table->head[0] = __('Name'); -$table->head[1] = __('Group'); -$table->head[2] = __('Event type'); -$table->head[3] = __('Event status'); -$table->head[4] = __('Severity'); -$table->head[5] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); +$table->head[0] = html_print_checkbox('all_delete', 0, false, true, false); +$table->head[1] = __('Name'); +$table->head[2] = __('Group'); +$table->head[3] = __('Event type'); +$table->head[4] = __('Event status'); +$table->head[5] = __('Severity'); +$table->head[6] = __('Action'); $table->style = []; -$table->style[0] = 'font-weight: bold'; +$table->style[1] = 'font-weight: bold'; $table->align = []; -$table->align[1] = 'left'; $table->align[2] = 'left'; $table->align[3] = 'left'; - $table->align[4] = 'left'; + $table->align[5] = 'left'; +$table->align[6] = 'left'; $table->size = []; -$table->size[0] = '50%'; -$table->size[1] = '5px'; -$table->size[2] = '80px'; +$table->size[0] = '20px'; +$table->size[1] = '50%'; +$table->size[2] = '5px'; $table->size[3] = '80px'; $table->size[4] = '80px'; -$table->size[5] = '40px'; +$table->size[5] = '80px'; +$table->size[6] = '40px'; $table->data = []; $total_filters = db_get_all_rows_filter('tevent_filter', false, 'COUNT(*) AS total'); @@ -147,13 +149,14 @@ $total_filters = $total_filters[0]['total']; foreach ($filters as $filter) { $data = []; - $data[0] = ''.$filter['id_name'].''; - $data[1] = ui_print_group_icon($filter['id_group_filter'], true); - $data[2] = events_get_event_types($filter['event_type']); - $data[3] = events_get_status($filter['status']); - $data[4] = events_get_severity_types($filter['severity']); - $data[5] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''.html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true); + $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true); + $data[1] = ''.$filter['id_name'].''; + $data[2] = ui_print_group_icon($filter['id_group_filter'], true); + $data[3] = events_get_event_types($filter['event_type']); + $data[4] = events_get_status($filter['status']); + $data[5] = events_get_severity_types($filter['severity']); + $table->cellclass[][6] = 'action_buttons'; + $data[6] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; array_push($table->data, $data); } @@ -188,8 +191,6 @@ echo '
'; ?> + diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 2bb4f6ab00..2ab1b8d967 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -40,7 +40,9 @@ if ($servers === false) { $table = new StdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; +$table->cellpadding = 0; +$table->cellspacing = 0; $table->size = []; $table->style = []; @@ -80,7 +82,11 @@ $names_servers = []; foreach ($servers as $server) { $data = []; - $table->cellclass[][3] = 'progress_bar'; + // $table->cellclass[][3] = 'progress_bar'; + $table->cellclass[] = [ + 3 => 'progress_bar', + 8 => 'action_buttons', + ]; $data[0] = ''.strip_tags($server['name']).''; // Status @@ -155,7 +161,7 @@ foreach ($servers as $server) { 'style' => 'width:21px;height:21px;', ] ); - $data[8] .= '  '; + $data[8] .= ''; } if ($server['type'] == 'data') { @@ -165,7 +171,7 @@ foreach ($servers as $server) { true, ['title' => __('Reset module status and fired alert counts')] ); - $data[8] .= '  '; + $data[8] .= ''; } else if ($server['type'] == 'enterprise snmp') { $data[8] .= ''; $data[8] .= html_print_image( @@ -173,7 +179,7 @@ foreach ($servers as $server) { true, ['title' => __('Claim back SNMP modules')] ); - $data[8] .= '  '; + $data[8] .= ''; } $data[8] .= ''; @@ -195,7 +201,7 @@ foreach ($servers as $server) { $names_servers[$safe_server_name] = false; } - $data[8] .= '  '; + $data[8] .= ''; $data[8] .= html_print_image( 'images/cross.png', true, diff --git a/pandora_console/godmode/setup/gis.php b/pandora_console/godmode/setup/gis.php index 946d0526ea..e6ff8dd3ab 100755 --- a/pandora_console/godmode/setup/gis.php +++ b/pandora_console/godmode/setup/gis.php @@ -63,14 +63,15 @@ switch ($action) { break; } +$table->class = 'info_table'; $table->width = '98%'; $table->head[0] = __('Map connection name'); $table->head[1] = __('Group'); $table->head[3] = __('Delete'); -$table->align[1] = 'center'; -$table->align[2] = 'center'; -$table->align[3] = 'center'; +$table->align[1] = 'left'; +$table->align[2] = 'left'; +$table->align[3] = 'left'; $mapsConnections = db_get_all_rows_in_table('tgis_map_connection', 'conection_name'); @@ -84,6 +85,7 @@ if ($mapsConnections !== false) { ''.html_print_image('images/cross.png', true).'', ]; + $table->cellclass[][2] = 'action_buttons'; } } diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index f5016e666e..c15052412b 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -137,9 +137,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { if (empty($rows)) { ui_print_info_message(['no_close' => true, 'message' => __("There isn't links") ]); } else { - echo ""; + echo "
"; + echo ''; echo "'; echo "'; + echo ''; $color = 1; foreach ($rows as $row) { @@ -152,7 +154,7 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { } echo "'; - echo ''; + echo ''; } echo '
".__('Link name').'".__('Delete').'
".$row['name'].''.html_print_image('images/cross.png', true).'
'.html_print_image('images/cross.png', true).'
'; diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 7b663bad53..4e51181b8a 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -231,14 +231,15 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined news') ]); } else { // Main list view for Links editor - echo ""; + echo "
"; + echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; - + echo ''; $color = 1; @@ -276,7 +277,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { echo "'; } - echo ''; + echo ''; } echo '
'.__('Subject').''.__('Type').''.__('Author').''.__('Timestamp').''.__('Expiration').''.__('Delete').'
".__('No').''.html_print_image('images/cross.png', true, ['border' => '0']).'
'.html_print_image('images/cross.png', true, ['border' => '0']).'
'; diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index f00b8cb00d..07365edc6c 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -25,7 +25,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->head[0] = ''; $table->head[1] = __('ID'); @@ -37,7 +37,19 @@ $table->align[4] = 'center'; $table->size[0] = '20px'; $table->size[4] = '20px'; -$osList = db_get_all_rows_in_table('tconfig_os'); +// Prepare pagination. +$offset = (int) get_parameter('offset'); +$limit = $config['block_size']; +$count_osList = db_get_value('count(*)', 'tconfig_os'); + +$osList = db_get_all_rows_filter( + 'tconfig_os', + [ + 'offset' => $offset, + 'limit' => $limit, + ] +); + if ($osList === false) { $osList = []; } @@ -54,6 +66,8 @@ foreach ($osList as $os) { } $data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true); + + $table->cellclass[][4] = 'action_buttons'; if ($os['id_os'] > 16) { if (is_metaconsole()) { $data[] = ''.html_print_image('images/cross.png', true).''; @@ -69,7 +83,9 @@ foreach ($osList as $os) { } if (isset($data)) { + ui_pagination($count_osList, false, $offset); html_print_table($table); + ui_pagination($count_osList, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]); } diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index b87fb4c3dd..0d8e1e9480 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -226,13 +226,13 @@ if ($edit_filter > -2) { $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->align = []; $table->head[0] = __('Description'); $table->head[1] = __('Filter'); $table->head[2] = __('Action'); - $table->size[2] = '50px'; + $table->size[2] = '65px'; $table->align[2] = 'center'; foreach ($aglomerate_result as $ind => $row) { @@ -263,6 +263,7 @@ if ($edit_filter > -2) { $data[0] = $compose_id; $data[1] = implode(' AND ', $compose_filter); $data[2] = $compose_action; + $table->cellclass[][2] = 'action_buttons'; array_push($table->data, $data); } } diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index d717a9095e..9d5040c0de 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -191,7 +191,7 @@ if (!empty($result)) { $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->data = []; $table->head = []; @@ -278,12 +278,14 @@ if (!empty($result)) { $data[5] = $output; - $data[6] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).'  '; + $table->cellclass[][6] = 'action_buttons'; + $data[6] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).''; $data[6] .= ''.html_print_image('images/cross.png', true, ['title' => 'Delete']).''; array_push($table->data, $data); } html_print_table($table); + ui_pagination($total_tags, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); } else { if (is_metaconsole()) { ui_toggle($filter_form, __('Show Options')); diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index 8b23527ac8..afc2b9813c 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -258,7 +258,7 @@ if ($create_profile) { $table = new stdClass(); $table->cellpadding = 0; $table->cellspacing = 0; -$table->class = 'databox profile_list data'; +$table->class = 'info_table profile_list'; $table->width = '100%'; $table->head = []; @@ -353,8 +353,9 @@ foreach ($profiles as $profile) { $data['VW'] = ($profile['vconsole_edit'] ? $img : ''); $data['VM'] = ($profile['vconsole_management'] ? $img : ''); $data['PM'] = ($profile['pandora_management'] ? $img : ''); + $table->cellclass[]['operations'] = 'action_buttons'; $data['operations'] = ''.html_print_image('images/config.png', true, ['title' => __('Edit')]).''; - $data['operations'] .= '  '.html_print_image('images/cross.png', true).''; + $data['operations'] .= ''.html_print_image('images/cross.png', true).''; array_push($table->data, $data); } diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 6b4d19ad28..63caad6d3f 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -38,13 +38,13 @@ $sort = get_parameter('sort', 'none'); $tab = get_parameter('tab', 'user'); $pure = get_parameter('pure', 0); -$selected = 'border: 1px solid black;'; -$selectUserIDUp = ''; -$selectUserIDDown = ''; -$selectFullnameUp = ''; -$selectFullnameDown = ''; -$selectLastConnectUp = ''; -$selectLastConnectDown = ''; +$selected = true; +$selectUserIDUp = false; +$selectUserIDDown = false; +$selectFullnameUp = false; +$selectFullnameDown = false; +$selectLastConnectUp = false; +$selectLastConnectDown = false; $order = null; switch ($sortField) { @@ -110,11 +110,11 @@ switch ($sortField) { default: $selectUserIDUp = $selected; - $selectUserIDDown = ''; - $selectFullnameUp = ''; - $selectFullnameDown = ''; - $selectLastConnectUp = ''; - $selectLastConnectDown = ''; + $selectUserIDDown = false; + $selectFullnameUp = false; + $selectFullnameDown = false; + $selectLastConnectUp = false; + $selectLastConnectDown = false; $order = [ 'field' => 'id_user', 'order' => 'ASC', @@ -300,11 +300,20 @@ if (defined('METACONSOLE')) { ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search); } +// Urls to sort the table. +$url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure; +$url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure; +$url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure; +$url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure; +$url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure; +$url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure; + + $table = new stdClass(); $table->cellpadding = 0; $table->cellspacing = 0; $table->width = '100%'; -$table->class = 'databox data'; +$table->class = 'info_table'; $table->head = []; $table->data = []; @@ -312,9 +321,10 @@ $table->align = []; $table->size = []; $table->valign = []; -$table->head[0] = __('User ID').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectUserIDUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectUserIDDown]).''; -$table->head[1] = __('Name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectFullnameUp ]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectFullnameDown]).''; -$table->head[2] = __('Last contact').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectLastConnectUp ]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectLastConnectDown]).''; +$table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown); +$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown); +$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown); + $table->head[3] = __('Admin'); $table->head[4] = __('Profile / Group'); $table->head[5] = __('Description'); @@ -514,6 +524,7 @@ foreach ($info as $user_id => $user_info) { $data[5] = ui_print_string_substr($user_info['comments'], 24, true); + $table->cellclass[][6] = 'action_buttons'; if ($user_info['disabled'] == 0) { $data[6] = ''.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).''; } else { @@ -535,6 +546,7 @@ foreach ($info as $user_id => $user_info) { } html_print_table($table); +ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom'); echo '
'; unset($table); diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 610353ebb7..da163406ee 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -96,8 +96,20 @@ class DiscoveryTaskList extends Wizard ] ); - // Header - ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + // Header. + ui_print_page_header( + __('Task list'), + '', + false, + '', + true, + '', + false, + '', + GENERIC_SIZE_TEXT, + '', + $this->printHeader(true) + ); // Show redirected messages from discovery.php. if ($status === 0) { @@ -352,10 +364,10 @@ class DiscoveryTaskList extends Wizard $url_ajax = $config['homeurl'].'ajax.php'; $table = new StdClass(); - $table->cellpadding = 4; - $table->cellspacing = 4; + $table->cellpadding = 0; + $table->cellspacing = 0; $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->head = []; $table->data = []; $table->align = []; @@ -404,15 +416,30 @@ class DiscoveryTaskList extends Wizard // Exceptions: IPAM. $ipam = false; if ($task['id_recon_script'] != null) { - $recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']); - if (io_safe_output($recon_script_name) == 'IPAM Recon' - && enterprise_installed() - ) { - $subnet_obj = json_decode($task['macros'], true); - $subnet = $subnet_obj['1']['value']; - $tipam_task_id = db_get_value('id', 'tipam_network', 'id_recon_task', $task['id_rt']); - $ipam = true; + $recon_script_data = db_get_row( + 'trecon_script', + 'id_recon_script', + $task['id_recon_script'] + ); + if ($recon_script_data !== false) { + $recon_script_name = $recon_script_data['name']; + if (io_safe_output($recon_script_name) == 'IPAM Recon' + && enterprise_installed() + ) { + $subnet_obj = json_decode($task['macros'], true); + $subnet = $subnet_obj['1']['value']; + $tipam_task_id = db_get_value( + 'id', + 'tipam_network', + 'id_recon_task', + $task['id_rt'] + ); + $ipam = true; + } } + } else { + $recon_script_data = false; + $recon_script_name = false; } if ($task['disabled'] == 0 && $server_name !== '') { @@ -464,15 +491,56 @@ class DiscoveryTaskList extends Wizard } if ($task['id_recon_script'] == 0) { - // Discovery NetScan. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery NetScan')] - ).'  '; - $data[6] .= network_profiles_get_name( - $task['id_network_profile'] - ); + // Internal discovery task. + switch ($task['type']) { + case DISCOVERY_CLOUD_AWS_RDS: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Cloud RDS')] + ).'  '; + $data[6] .= __('Discovery.Cloud.Aws.RDS'); + break; + + case DISCOVERY_APP_MYSQL: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications MySQL')] + ).'  '; + $data[6] .= __('Discovery.App.MySQL'); + break; + + case DISCOVERY_APP_ORACLE: + // Discovery Applications Oracle. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications Oracle')] + ).'  '; + $data[6] .= __('Discovery.App.Oracle'); + break; + + case DISCOVERY_HOSTDEVICES: + default: + // Discovery NetScan. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery NetScan')] + ).'  '; + $str = network_profiles_get_name( + $task['id_network_profile'] + ); + if (!empty($str)) { + $data[6] .= $str; + } else { + $data[6] .= __('Discovery.NetScan'); + } + break; + } } else { // APP recon task. $data[6] = html_print_image( @@ -512,7 +580,11 @@ class DiscoveryTaskList extends Wizard $data[9] .= ''; } - if ($task['disabled'] != 2 && $task['utimestamp'] > 0) { + if ($task['disabled'] != 2 && $task['utimestamp'] > 0 + && $task['type'] != DISCOVERY_APP_MYSQL + && $task['type'] != DISCOVERY_APP_ORACLE + && $task['type'] != DISCOVERY_CLOUD_AWS_RDS + ) { $data[9] .= ''; $data[9] .= html_print_image( 'images/dynamic_network_icon.png', @@ -548,7 +620,7 @@ class DiscoveryTaskList extends Wizard $data[9] .= ''.html_print_image( @@ -566,6 +638,8 @@ class DiscoveryTaskList extends Wizard $data[9] = ''; } + $table->cellclass[][9] = 'action_buttons'; + // Div neccesary for modal progress task. echo ''; @@ -606,28 +680,49 @@ class DiscoveryTaskList extends Wizard /** * Return target url sub-string to edit target task. * - * @param array $task With all data. + * @param array $task With all data. + * @param array $script With all script data or false if undefined. * * @return string */ - public function getTargetWiz($task) + public function getTargetWiz($task, $script=false) { - // TODO: Do not use description. Use recon_script ID instead. - switch ($task['description']) { - case 'Discovery.Application.VMware': - return 'wiz=app&mode=vmware&page=0'; + if ($script !== false) { + switch ($script['type']) { + case DISCOVERY_SCRIPT_CLOUD_AWS: + return 'wiz=cloud&mode=amazonws&page=1'; - case CLOUDWIZARD_AWS_DESCRIPTION: + case DISCOVERY_SCRIPT_APP_VMWARE: + return 'wiz=app&mode=vmware&page=0'; + + case DISCOVERY_SCRIPT_IPAM_RECON: + return ''; + + case DISCOVERY_SCRIPT_IPMI_RECON: + default: + return 'wiz=hd&mode=customnetscan'; + } + } + + switch ($task['type']) { + case DISCOVERY_APP_MYSQL: + return 'wiz=app&mode=mysql&page=0'; + + case DISCOVERY_APP_ORACLE: + return 'wiz=app&mode=oracle&page=0'; + + case DISCOVERY_CLOUD_AWS: + case DISCOVERY_CLOUD_AWS_EC2: return 'wiz=cloud&mode=amazonws&page=1'; - case 'console_task': - return 'wiz=ctask'; + case DISCOVERY_CLOUD_AWS_RDS: + return 'wiz=cloud&mode=amazonws&sub=rds&page=0'; default: - if ($task['id_recon_script'] === null) { - return 'wiz=hd&mode=netscan'; + if ($task['description'] == 'console_task') { + return 'wiz=ctask'; } else { - return 'wiz=hd&mode=customnetscan'; + return 'wiz=hd&mode=netscan'; } break; } diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index e4e0e97fdc..9ac87d9baa 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -149,7 +149,8 @@ class HostDevices extends Wizard ), 'label' => __('Discovery'), ], - ] + ], + true ); ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); @@ -533,7 +534,19 @@ class HostDevices extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + ui_print_page_header( + __('NetScan'), + '', + false, + '', + true, + '', + false, + '', + GENERIC_SIZE_TEXT, + '', + $this->printHeader(true) + ); } if (isset($this->page) === true @@ -581,113 +594,83 @@ class HostDevices extends Wizard if (isset($this->page) === false || $this->page == 0 ) { - $form = []; - // Input task name. - $form['inputs'][] = [ - 'label' => ''.__('Task name').'', - 'arguments' => [ + // Comment input + $comment_input ='
'; + + $comment_input .= $this->printInput([ + 'name' => 'comment', + 'rows' => 1, + 'columns' => 1, + 'value' => $this->task['description'], + 'type' => 'textarea', + 'size' => 25, + 'class' => 'discovery_textarea_input', + 'return' => true + ]); + + // Task input + $taskname_input_label = '
'; + + $taskname_input = $this->printInput([ 'name' => 'taskname', 'value' => $this->task['name'], 'type' => 'text', 'size' => 25, - ], - ]; + 'class' => 'discovery_full_width_input' + ]); - if (isset($this->task['id_rt']) === true) { - // Propagate id. - $form['inputs'][] = [ - 'arguments' => [ - 'name' => 'task', - 'value' => $this->task['id_rt'], - 'type' => 'hidden', - ], - ]; - } + // Network input + $network_input_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).'
'; - // Input task name. - $form['inputs'][] = [ - 'label' => ''.__('Comment').'', - 'arguments' => [ - 'name' => 'comment', - 'value' => $this->task['description'], - 'type' => 'text', - 'size' => 25, - ], - ]; - - // Input Discovery Server. - $form['inputs'][] = [ - 'label' => ''.__('Discovery server').''.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', - 'selected' => $this->task['id_recon_server'], - 'return' => true, - ], - ]; - - // Input Network. - $form['inputs'][] = [ - - 'label' => ''.__('Network').''.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' => [ + $network_input = $this->printInput([ 'name' => 'network', 'value' => $this->task['subnet'], 'type' => 'text', 'size' => 25, - ], - ]; + 'class' => 'discovery_full_width_input', + ]); - // Input Group. - $form['inputs'][] = [ - 'label' => ''.__('Group').'', - 'arguments' => [ - 'name' => 'id_group', - 'returnAllGroup' => false, - 'privilege' => 'PM', - 'type' => 'select_groups', - 'selected' => $this->task['id_group'], - 'return' => true, - ], - ]; - // Interval and schedules. + // Discovery server input + $discovery_server_select_label = '
'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'
'; + + $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; if ((int) $this->task['interval_sweep'] == 0) { $interv_manual = 1; } - // Schedule. - $form['inputs'][] = [ - 'label' => ''.__('Interval').''.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, + $interval_input_label = '
'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'
'; + + $interval_input = $this->printInput([ + 'type' => 'select', + 'selected' => $interv_manual, + 'fields' => [ + 0 => __('Defined'), + 1 => __('Manual'), ], - 'extra' => ''.html_print_extended_select_for_time( + 'name' => 'interval_manual_defined', + 'return' => true, + 'style' => 'float: right;' + ]); + + $interval_input_extra = ''.html_print_extended_select_for_time( 'interval', $this->task['interval_sweep'], '', @@ -700,36 +683,38 @@ class HostDevices extends Wizard ).ui_print_help_tip( __('The minimum recomended interval for Recon Task is 5 minutes'), true - ).'', - ]; + ).''; - $str = __('Next'); - if (isset($this->task['id_rt']) === true) { - $str = __('Update and continue'); + // Group select + $group_select = '
'; + + $group_select .= $this->printInput([ + 'name' => 'id_group', + 'returnAllGroup' => false, + 'privilege' => 'PM', + 'type' => 'select_groups', + 'selected' => $this->task['id_group'], + 'return' => true, + 'class' => 'discovery_list_input', + 'size' => 9, + 'simple_multiple_options' => true, + ]); + + if (isset($this->task['id_rt']) === true) { + //Propagate ID + $task_hidden = $this->printInput([ + 'name' => 'task', + 'value' => $this->task['id_rt'], + 'type' => 'hidden' + ]); } - // Submit button. - $form['inputs'][] = [ - 'arguments' => [ - 'name' => 'submit', - 'label' => $str, - 'type' => 'submit', - 'attributes' => 'class="sub next"', - 'return' => true, - ], - ]; - $task_url = ''; if (isset($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. $interval = 600; $unit = 60; @@ -738,24 +723,62 @@ class HostDevices extends Wizard $unit = $this->getTimeUnit($interval); } - $form['js'] = ' -$("select#interval_manual_defined").change(function() { - if ($("#interval_manual_defined").val() == 1) { - $("#interval_manual_container").hide(); - $("#text-interval_text").val(0); - $("#hidden-interval").val(0); - } - else { - $("#interval_manual_container").show(); - $("#text-interval_text").val(10); - $("#hidden-interval").val('.$interval.'); - $("#interval_units").val('.$unit.'); - } -}).change();'; - // XXX: Could be improved validating inputs before continue (JS) // Print NetScan page 0. - $this->printForm($form); + //$this->printForm($form); + + echo ''; + echo $task_hidden; + + echo '
+
+
' + .'
'.html_print_image ("images/wizard/netscan_green.png", true, array ("title" => __('Close'), "style" => 'width: 60%;'), false).'
' + .'
'.$interval_input_label.'
'.$interval_input.'
'.$interval_input_extra.'
' + .'
+ +
+
'.$taskname_input_label.'
'.$taskname_input.'
' + .'
'.$discovery_server_select_label.$discovery_server_select.'
' + .'
'.$network_input_label.'
'.$network_input.'
' + .'
' + .'
'.$group_select.'
' + .'
' + + .'
+
+ '.$comment_input.' +
+
' + .'
'; + + $str = __('Next'); + + if (isset($this->task['id_rt']) === true) { + $str = __('Update and continue'); + } + + echo '
'.html_print_submit_button($str, 'submit', false, 'class="sub next"', true).'
'; + echo ''; + + echo ''; + } } @@ -783,7 +806,7 @@ $("select#interval_manual_defined").change(function() { ]; $form['inputs'][] = [ - 'extra' => '

Please, configure task '.io_safe_output($this->task['name']).'

', + 'extra' => '

Please, configure task '.io_safe_output($this->task['name']).'

', ]; // Input: Module template. @@ -799,7 +822,6 @@ $("select#interval_manual_defined").change(function() { 'selected' => $this->task['id_network_profile'], 'nothing_value' => 0, 'nothing' => __('None'), - ], ]; @@ -850,7 +872,7 @@ $("select#interval_manual_defined").change(function() { 'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'], ]; - $this->printForm($form); + $this->printForm($form, false, true); } if ($this->page == 2) { diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 022402a8d1..9bdee3b001 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -191,21 +191,19 @@ class Wizard * Builder for breadcrum * * @param array $urls Array of urls to be stored in breadcrum. - * @param boolean $add True if breadcrum should be added instead of - * overwrite it. + * @param boolean $add True if breadcrum should be added + * instead of overwrite it. * * @return void */ - public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false) - { + public function prepareBreadcrum( + array $urls, + bool $add=false + ) { $bc = []; $i = 0; - $count = 0; - $array_size = count($urls); foreach ($urls as $url) { - $count++; - if ($url['selected'] == 1) { $class = 'selected'; } else { @@ -213,20 +211,10 @@ class Wizard } $bc[$i] = ''; - - if ($separator_beginning === true) { - $bc[$i] .= ' / '; - } - - $bc[$i] .= '
'; - $bc[$i] .= $url['label']; - $bc[$i] .= ''; - if ($count < $array_size) { - $bc[$i] .= ' / '; - } - + $bc[$i] .= ''; + $bc[$i] .= $url['label']; + $bc[$i] .= ''; $bc[$i] .= ''; - $i++; } @@ -235,7 +223,6 @@ class Wizard } else { $this->setBreadcrum($bc); } - } @@ -275,7 +262,10 @@ class Wizard */ public function printBreadcrum() { - return implode('', $this->breadcrum); + return implode( + ' / ', + $this->breadcrum + ); } @@ -483,7 +473,9 @@ class Wizard ((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'), ((isset($data['strict_user']) === true) ? $data['strict_user'] : false), ((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false), - ((isset($data['include_groups']) === true) ? $data['include_groups'] : false) + ((isset($data['include_groups']) === true) ? $data['include_groups'] : false), + ((isset($data['size']) === true) ? $data['size'] : false), + ((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false) ); case 'submit': @@ -640,7 +632,7 @@ class Wizard * * @return string HTML code. */ - public function printForm(array $data, bool $return=false) + public function printForm(array $data, bool $return=false, bool $print_white_box=false) { $form = $data['form']; $inputs = $data['inputs']; @@ -666,13 +658,27 @@ class Wizard error_log('Error executing wizard callback: ', $e->getMessage()); } - $output = '
    '; + $output_submit = ''; + $output = ''; + + if ($print_white_box === true) + $output .= '
    '; + + $output .= '
      '; foreach ($inputs as $input) { - $output .= $this->printBlock($input, true); + if ($input['arguments']['type']!='submit') + $output .= $this->printBlock($input, true); + else + $output_submit .= $this->printBlock($input, true); } $output .= '
    '; + + if ($print_white_box === true) + $output .= '
    '; + + $output .= '
      '.$output_submit.'
    '; $output .= ''; $output .= ''; diff --git a/pandora_console/images/arrow_down_green.png b/pandora_console/images/arrow_down_green.png new file mode 100644 index 0000000000..edc1cff1b8 Binary files /dev/null and b/pandora_console/images/arrow_down_green.png differ diff --git a/pandora_console/images/arrow_down_white.png b/pandora_console/images/arrow_down_white.png new file mode 100644 index 0000000000..7b28df71f9 Binary files /dev/null and b/pandora_console/images/arrow_down_white.png differ diff --git a/pandora_console/images/arrow_up_green.png b/pandora_console/images/arrow_up_green.png new file mode 100644 index 0000000000..c197c2333c Binary files /dev/null and b/pandora_console/images/arrow_up_green.png differ diff --git a/pandora_console/images/arrow_up_white.png b/pandora_console/images/arrow_up_white.png new file mode 100644 index 0000000000..2fbd55b69a Binary files /dev/null and b/pandora_console/images/arrow_up_white.png differ diff --git a/pandora_console/images/go_first_g.png b/pandora_console/images/go_first_g.png new file mode 100644 index 0000000000..dcb0fe41b8 Binary files /dev/null and b/pandora_console/images/go_first_g.png differ diff --git a/pandora_console/images/go_last_g.png b/pandora_console/images/go_last_g.png new file mode 100644 index 0000000000..ce49963baa Binary files /dev/null and b/pandora_console/images/go_last_g.png differ diff --git a/pandora_console/images/go_next_g.png b/pandora_console/images/go_next_g.png new file mode 100644 index 0000000000..08601a2a3e Binary files /dev/null and b/pandora_console/images/go_next_g.png differ diff --git a/pandora_console/images/go_previous_g.png b/pandora_console/images/go_previous_g.png new file mode 100644 index 0000000000..84bbe0492e Binary files /dev/null and b/pandora_console/images/go_previous_g.png differ diff --git a/pandora_console/images/imagen-no-acceso.jpg b/pandora_console/images/imagen-no-acceso.jpg new file mode 100644 index 0000000000..93b9256edb Binary files /dev/null and b/pandora_console/images/imagen-no-acceso.jpg differ diff --git a/pandora_console/images/sort_down_black.png b/pandora_console/images/sort_down_black.png new file mode 100644 index 0000000000..13ade460fc Binary files /dev/null and b/pandora_console/images/sort_down_black.png differ diff --git a/pandora_console/images/sort_down_green.png b/pandora_console/images/sort_down_green.png new file mode 100644 index 0000000000..dc6086912d Binary files /dev/null and b/pandora_console/images/sort_down_green.png differ diff --git a/pandora_console/images/sort_up_black.png b/pandora_console/images/sort_up_black.png new file mode 100644 index 0000000000..238d89520f Binary files /dev/null and b/pandora_console/images/sort_up_black.png differ diff --git a/pandora_console/images/sort_up_green.png b/pandora_console/images/sort_up_green.png new file mode 100644 index 0000000000..5c57937f40 Binary files /dev/null and b/pandora_console/images/sort_up_green.png differ diff --git a/pandora_console/images/timestamp.png b/pandora_console/images/timestamp.png new file mode 100644 index 0000000000..1750c4acbd Binary files /dev/null and b/pandora_console/images/timestamp.png differ diff --git a/pandora_console/images/wizard/netscan_green.png b/pandora_console/images/wizard/netscan_green.png new file mode 100644 index 0000000000..faeae9b042 Binary files /dev/null and b/pandora_console/images/wizard/netscan_green.png differ diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 6e93f12165..7ce37005ea 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -527,19 +527,19 @@ if (check_login()) { $show_notinit = (int) get_parameter('show_notinit', 0); $cluster_list = (int) get_parameter('cluster_list', 0); $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent; - $selectTypeUp = ''; - $selectTypeDown = ''; - $selectNameUp = ''; - $selectNameDown = ''; - $selectStatusUp = ''; - $selectStatusDown = ''; - $selectDataUp = ''; - $selectDataDown = ''; - $selectLastContactUp = ''; - $selectLastContactDown = ''; + $selectTypeUp = false; + $selectTypeDown = false; + $selectNameUp = false; + $selectNameDown = false; + $selectStatusUp = false; + $selectStatusDown = false; + $selectDataUp = false; + $selectDataDown = false; + $selectLastContactUp = false; + $selectLastContactDown = false; $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); - $selected = 'border: 1px solid black;'; + $selected = true; $order[] = [ 'field' => 'tmodule_group.name', @@ -627,16 +627,16 @@ if (check_login()) { break; default: - $selectTypeUp = ''; - $selectTypeDown = ''; + $selectTypeUp = false; + $selectTypeDown = false; $selectNameUp = $selected; - $selectNameDown = ''; - $selectStatusUp = ''; - $selectStatusDown = ''; - $selectDataUp = ''; - $selectDataDown = ''; - $selectLastContactUp = ''; - $selectLastContactDown = ''; + $selectNameDown = false; + $selectStatusUp = false; + $selectStatusDown = false; + $selectDataUp = false; + $selectDataDown = false; + $selectLastContactUp = false; + $selectLastContactDown = false; $order[] = [ 'field' => 'tagente_modulo.nombre', @@ -756,11 +756,22 @@ if (check_login()) { $modules = []; } + // Urls to sort the table. + $url_up_type = $url.'&sort_field=type&sort=up&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_down_type = $url.'&sort_field=type&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_up_name = $url.'&sort_field=name&sort=up&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_down_name = $url.'&sort_field=name&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_up_status = $url.'&sort_field=status&sort=up&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_down_status = $url.'&sort_field=status&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_up_last = $url.'&sort_field=last_contact&sort=up&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + $url_down_last = $url.'&sort_field=last_contact&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group; + + $table = new stdClass(); $table->width = '100%'; - $table->cellpadding = 4; - $table->cellspacing = 4; - $table->class = 'databox data'; + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->class = 'info_table'; $table->head = []; $table->data = []; @@ -773,17 +784,15 @@ if (check_login()) { $table->head[1] = "".__('P.').''; } - $table->head[2] = __('Type').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectTypeUp, 'alt' => 'up']).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectTypeDown, 'alt' => 'down']).''; - $table->head[3] = __('Module name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp, 'alt' => 'up']).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown, 'alt' => 'down']).''; + $table->head[2] = __('Type').ui_get_sorting_arrows($url_up_type, $url_down_type, $selectTypeUp, $selectTypeDown); + $table->head[3] = __('Module name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectNameUp, $selectNameDown); $table->head[4] = __('Description'); - $table->head[5] = __('Status').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp, 'alt' => 'up']).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectStatusDown, 'alt' => 'down']).''; + $table->head[5] = __('Status').ui_get_sorting_arrows($url_up_status, $url_down_status, $selectStatusUp, $selectStatusDown); $table->head[6] = __('Thresholds'); $table->head[7] = __('Data'); $table->head[8] = __('Graph'); $table->headstyle[8] = 'min-width: 60px'; - $table->head[9] = __('Last contact').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp, 'alt' => 'up']).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown, 'alt' => 'down']).''; - - + $table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown); $table->align = [ 'left', 'left', @@ -896,7 +905,7 @@ if (check_login()) { $data[2] = servers_show_type($module['id_modulo']).' '; if (check_acl($config['id_user'], $id_grupo, 'AW')) { - $data[2] .= ''.html_print_image('images/config.png', true, ['alt' => '0', 'border' => '', 'title' => __('Edit')]).''; + $data[2] .= ''.html_print_image('images/config.png', true, ['alt' => '0', 'border' => '', 'title' => __('Edit'), 'class' => 'action_button_img']).''; } @@ -1199,7 +1208,7 @@ if (check_login()) { false, 'offset', true, - '', + 'pagination-bottom', 'pagination_list_modules(offset_param)', [ 'count' => '', diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index 4f69ecaed0..6d50b3c892 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -45,23 +45,25 @@ if ($progress_task_discovery) { $result = '
    '; if ($task['utimestamp']) { - $result .= '
      '; - $result .= '
    • '._('Overall Progress').'

    • '; - $result .= '
    • '; - $result .= d3_progress_bar( + $result .= '
      '; + $result .= '
      '; + $result .= ''._('Overall Progress').''; + + $result .= '
      '; + $result .= progress_circular_bar( $id_task, ($global_progress < 0) ? 100 : $global_progress, - 460, - 30, - '#EA5434', + 200, + 200, + '#7eb641', '%', '', - '#FFFFFF', - 0, - 0, + '#3A3A3A', 0 ); + $result .= '
      '; + if ($global_progress > 0) { switch ($summary['step']) { case STEP_SCANNING: @@ -85,28 +87,28 @@ if ($progress_task_discovery) { break; } - $result .= '
    • '; - $result .= '
    • '.$str.' '; + $result .= '

    '; + $result .= '
    '; + $result .= ''.$str.' '; $result .= $summary['c_network_name']; - $result .= ''; - $result .= '
  • '; - $result .= d3_progress_bar( + $result .= ''; + + $result .= '
    '; + $result .= progress_circular_bar( $id_task.'_detail', $summary['c_network_percent'], - 460, - 30, - '#2751E1', + 200, + 200, + '#7eb641', '%', '', - '#FFFFFF', - 0, - 0, + '#3A3A3A', 0 ); - $result .= '
  • '; + $result .= '
'; } - $result .= ''; + $result .= '
'; $i = 0; $table = new StdClasS(); @@ -142,6 +144,7 @@ if ($progress_task_discovery) { $table->data[$i][1] .= $summary['summary']['WMI']; $table->data[$i++][1] .= ''; + $result .= '
'.__('Summary').'
'; $result .= html_print_table($table, true).''; } else { $global_progress = -1; diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php index 3b04cedd24..1f60848ca1 100644 --- a/pandora_console/include/api.php +++ b/pandora_console/include/api.php @@ -37,13 +37,10 @@ $api_password = get_parameter('apipass', ''); $password = get_parameter('pass', ''); $user = get_parameter('user', ''); $info = get_parameter('info', ''); - $other = parseOtherParameter($otherSerialize, $otherMode); - $apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password'])); $correctLogin = false; -$user_in_db = null; $no_login_msg = ''; // Clean unwanted output @@ -107,7 +104,6 @@ if ($correctLogin) { if ($op == 'set' && $id) { switch ($op2) { case 'update_agent': - case 'add_module_in_conf': case 'update_module_in_conf': case 'delete_module_in_conf': @@ -149,8 +145,45 @@ if ($correctLogin) { } break; - default: + case 'delete_user_permission': + if ($user_db === '') { + returnError(__('User or group not specified'), __('User, group not specified')); + return; + } + + $id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType); + + if ($id_os != 100) { + return; + } + + if ($id_os == false) { + returnError('not_allowed_operation_cluster', $returnType); + return false; + } + break; + + case 'add_permission_user_to_group': + + if ($user_db == null || $group_db == null || $id_up == null) { + returnError(__('User, group or profile not specified'), __('User, group or profile status not specified')); + return; + } + + $id_os = api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType); + + if ($id_os != 100) { + return; + } + + if ($id_os == false) { + returnError('not_allowed_operation_cluster', $returnType); + return false; + } + break; + + default: // break; } } diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index 7477594637..078d23fa6b 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -438,7 +438,7 @@ class CustomNetScan extends Wizard // Input task name. $form['inputs'][] = [ - 'label' => ''.__('Task name').'', + 'label' => __('Task name'), 'arguments' => [ 'name' => 'taskname', 'value' => $this->task['name'], @@ -460,7 +460,7 @@ class CustomNetScan extends Wizard // Input task description. $form['inputs'][] = [ - 'label' => ''.__('Comment').'', + 'label' => __('Comment'), 'arguments' => [ 'name' => 'comment', 'value' => $this->task['description'], @@ -471,7 +471,7 @@ class CustomNetScan extends Wizard // Input Discovery Server. $form['inputs'][] = [ - 'label' => ''.__('Discovery server').''.ui_print_help_tip( + 'label' => __('Discovery server').ui_print_help_tip( __('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true ), @@ -492,7 +492,7 @@ class CustomNetScan extends Wizard // Input Group. $form['inputs'][] = [ - 'label' => ''.__('Group').'', + 'label' => __('Group'), 'arguments' => [ 'name' => 'id_group', 'returnAllGroup' => false, @@ -511,7 +511,7 @@ class CustomNetScan extends Wizard // Schedule. $form['inputs'][] = [ - 'label' => ''.__('Interval').''.ui_print_help_tip( + 'label' => __('Interval').ui_print_help_tip( __('Manual interval means that it will be executed only On-demand'), true ), @@ -594,7 +594,7 @@ class CustomNetScan extends Wizard // XXX: Could be improved validating inputs before continue (JS) // Print NetScan page 0. - $this->printForm($form); + $this->printForm($form, false, true); } } @@ -602,7 +602,7 @@ class CustomNetScan extends Wizard $name_ipam = 'IPAM Recon'; // Recon script. $form['inputs'][] = [ - 'label' => ''.__('Recon script').'', + 'label' => __('Recon script'), 'arguments' => [ 'type' => 'select_from_sql', 'sql' => sprintf( @@ -643,7 +643,7 @@ class CustomNetScan extends Wizard ); $form['inputs'][] = [ - 'label' => ''.__('Explanation').'', + 'label' => __('Explanation').'', 'arguments' => [ 'type' => 'textarea', 'rows' => 4, @@ -652,6 +652,7 @@ class CustomNetScan extends Wizard 'value' => $explanation, 'return' => true, 'attributes' => 'style="width: 388px;"', + 'class' => 'discovery_textarea_input' ], ]; @@ -663,8 +664,9 @@ class CustomNetScan extends Wizard 'name' => 'macro_name', 'value' => 'macro_value', 'type' => 'text', - 'size' => 100, + 'size' => 50, 'return' => true, + ], ]; @@ -740,7 +742,7 @@ class CustomNetScan extends Wizard get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'"); })'.$change; - $this->printForm($form); + $this->printForm($form, false, true); } if (isset($this->page) === true && $this->page === 2) { diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index f3ca4c92b5..efc94cc8b6 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -389,10 +389,12 @@ class ManageNetScanScripts extends Wizard $rows = db_get_all_rows_in_table('trecon_script'); if ($rows !== false) { - echo ''; + echo '
'; + echo ''; echo ''; echo ''; echo ''; + echo ''; $color = 0; foreach ($rows as $row) { if ($color == 1) { diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 17133d4d65..146e4d999f 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -34,9 +34,9 @@ enterprise_include_once('include/functions_networkmap.php'); enterprise_include_once('include/functions_discovery.php'); // Avoid node overlapping. -define('GRAPHVIZ_RADIUS_CONVERSION_FACTOR', 20); -define('MAP_X_CORRECTION', 600); -define('MAP_Y_CORRECTION', 150); +define('GRAPHVIZ_CONVERSION_FACTOR', 30); +define('MAP_X_CORRECTION', 0); +define('MAP_Y_CORRECTION', 0); /** @@ -191,6 +191,20 @@ class NetworkMap */ public $relations; + /** + * Private nodes converted to JS. + * + * @var array + */ + private $nodesJS; + + /** + * Private relations converted to JS. + * + * @var array + */ + private $relationsJS; + /** * Include a Pandora (or vendor) node or not. * @@ -319,6 +333,8 @@ class NetworkMap // Default mapOptions values. // Defines the command to generate positions. $this->mapOptions['generation_method'] = LAYOUT_SPRING1; + // Use fixed positions defined (X,Y) per node. + $this->mapOptions['fixed_positions'] = 0; $this->mapOptions['width'] = $config['networkmap_max_width']; $this->mapOptions['height'] = $config['networkmap_max_width']; $this->mapOptions['simple'] = 0; @@ -999,23 +1015,25 @@ class NetworkMap case NODE_GENERIC: // Handmade ones. // Add also parent relationship. - $parent_id = $node['id_parent']; + if (isset($node['id_parent'])) { + $parent_id = $node['id_parent']; - if ((int) $parent_id > 0) { - $parent_node = $this->getNodeData( - (int) $parent_id, - 'id_node' - ); - } + if ((int) $parent_id >= 0) { + $parent_node = $this->getNodeData( + (int) $parent_id, + 'id_node' + ); + } - // Store relationship. - if ($parent_node) { - $relations[] = [ - 'id_parent' => $parent_node, - 'parent_type' => NODE_GENERIC, - 'id_child' => $node['id_node'], - 'child_type' => NODE_GENERIC, - ]; + // Store relationship. + if ($parent_node !== null) { + $relations[] = [ + 'id_parent' => $parent_node, + 'parent_type' => NODE_GENERIC, + 'id_child' => $node['id_node'], + 'child_type' => NODE_GENERIC, + ]; + } } break; @@ -1224,6 +1242,11 @@ class NetworkMap return ''; } + if ($this->mapOptions['fixed_positions']) { + // Ignore. + return; + } + $dot_str = ''; // Color is being printed by D3, not graphviz. @@ -1233,8 +1256,22 @@ class NetworkMap $url = 'none'; $parent = $data['parent']; $font_size = $this->mapOptions['font_size']; - $radius = $this->mapOptions['map_filter']['node_radius']; - $radius /= GRAPHVIZ_RADIUS_CONVERSION_FACTOR; + if (isset($data['radius'])) { + $radius = $data['radius']; + } else { + $radius = $this->mapOptions['map_filter']['node_radius']; + } + + $radius /= GRAPHVIZ_CONVERSION_FACTOR; + + if (is_array($label)) { + $label = array_reduce( + function ($carry, $item) { + $carry .= $item; + return $carry; + } + ); + } if (strlen($label) > 16) { $label = ui_print_truncate_text($label, 16, false, true, false); @@ -1593,6 +1630,21 @@ class NetworkMap if (is_array($node['style']) === false) { $node['style'] = json_decode($node['style'], true); + + // Add styles. + if (isset($source_data['style']) === true + && is_array($source_data['style']) === true + ) { + $node['style'] = array_merge( + $node['style'], + $source_data['style'] + ); + } + } + + // Propagate styles. + foreach ($node['style'] as $k => $v) { + $item[$k] = $v; } $item['type'] = $node['type']; @@ -1632,9 +1684,15 @@ class NetworkMap $node[$k] = $v; } - $node['style']['label'] = $node['name']; + $node['style']['label'] = $node['label']; $node['style']['shape'] = 'circle'; - $item['color'] = self::getColorByStatus($node['status']); + if (isset($source_data['color'])) { + $item['color'] = $source_data['color']; + } else { + $item['color'] = self::getColorByStatus( + $node['status'] + ); + } break; } @@ -1679,6 +1737,7 @@ class NetworkMap $item['text'] = io_safe_output($node['style']['label']); $item['shape'] = $node['style']['shape']; $item['map_id'] = $node['id_map']; + if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0 @@ -1694,8 +1753,6 @@ class NetworkMap $item['image'] = $item['image_url']; $item['image_height'] = 52; $item['image_width'] = 52; - $item['width'] = $this->mapOptions['map_filter']['node_radius']; - $item['height'] = $this->mapOptions['map_filter']['node_radius']; } $return[] = $item; @@ -2036,6 +2093,10 @@ class NetworkMap 'id_source' => $id_source, 'label' => $label, 'image' => null, + 'radius' => max( + $node['width'], + $node['height'] + ), ] ); @@ -2148,8 +2209,8 @@ class NetworkMap if (preg_match('/^graph.*$/', $line) != 0) { // Graph definition. $fields = explode(' ', $line); - $this->map['width'] = ($fields[2] * 10 * GRAPHVIZ_RADIUS_CONVERSION_FACTOR); - $this->map['height'] = ($fields[3] * 10 * GRAPHVIZ_RADIUS_CONVERSION_FACTOR); + $this->map['width'] = ($fields[2] * GRAPHVIZ_CONVERSION_FACTOR); + $this->map['height'] = ($fields[3] * GRAPHVIZ_CONVERSION_FACTOR); if ($this->map['width'] > $config['networkmap_max_width']) { $this->map['width'] = $config['networkmap_max_width']; @@ -2162,8 +2223,8 @@ class NetworkMap // Node. $fields = explode(' ', $line); $id = $fields[1]; - $nodes[$id]['x'] = (($fields[2] * $this->mapOptions['map_filter']['node_radius']) - $this->mapOptions['map_filter']['rank_sep'] * GRAPHVIZ_RADIUS_CONVERSION_FACTOR); - $nodes[$id]['y'] = (($fields[3] * $this->mapOptions['map_filter']['node_radius']) - $this->mapOptions['map_filter']['rank_sep'] * GRAPHVIZ_RADIUS_CONVERSION_FACTOR); + $nodes[$id]['x'] = ($fields[2] * GRAPHVIZ_CONVERSION_FACTOR); + $nodes[$id]['y'] = ($fields[3] * GRAPHVIZ_CONVERSION_FACTOR); } else if (preg_match('/^edge.*$/', $line) != 0 && empty($this->relations) === true ) { @@ -2401,7 +2462,17 @@ class NetworkMap * Calculate X,Y positions. */ - $graph = $this->calculateCoords(); + if (!$this->mapOptions['fixed_positions']) { + $graph = $this->calculateCoords(); + } else { + // Set by user. + $graph['nodes'] = $this->rawNodes; + $graph['relations'] = $this->relations; + $this->map['width'] = $this->mapOptions['width']; + $this->map['height'] = $this->mapOptions['height']; + } + + $this->map['filter']['z_dash'] = $this->mapOptions['z_dash']; if (is_array($graph) === true) { $nodes = $graph['nodes']; @@ -2501,6 +2572,10 @@ class NetworkMap $style['image'] = $node_tmp['image']; $style['width'] = $node_tmp['width']; $style['height'] = $node_tmp['height']; + $style['radius'] = max( + $style['width'], + $style['height'] + ); $style['label'] = $node_tmp['text']; $node_tmp['style'] = json_encode($style); @@ -2658,6 +2733,10 @@ class NetworkMap $output .= "var z_dash = null;\n"; } + if (empty($networkmap['filter']['node_radius']) === true) { + $networkmap['filter']['node_radius'] = $this->mapOptions['map_filter']['node_radius']; + } + $output .= 'var networkmap_refresh_time = 1000 * '.$networkmap['source_period'].";\n"; $output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n"; $output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n"; @@ -2676,8 +2755,14 @@ class NetworkMap $nodes = []; } - $nodes_js = $this->nodesToJS($nodes); - $output .= 'networkmap.nodes = ('.json_encode($nodes_js).");\n"; + $this->nodesJS = $this->nodesToJS($nodes); + + $output .= 'networkmap.nodes = ('.json_encode($this->nodesJS).");\n"; + + // Clean. + unset($this->nodes); + unset($this->rawNodes); + unset($this->nodeMapping); // Translate edges to js links. $relations = $this->graph['relations']; @@ -2685,8 +2770,11 @@ class NetworkMap $relations = []; } - $links_js = $this->edgeToJS($relations); - $output .= 'networkmap.links = ('.json_encode($links_js).");\n"; + $this->relationsJS = $this->edgeToJS($relations); + $output .= 'networkmap.links = ('.json_encode($this->relationsJS).");\n"; + + // Clean. + unset($this->relations); $output .= ' //////////////////////////////////////////////////////////////////// @@ -3221,16 +3309,21 @@ class NetworkMap && $this->useTooltipster ) { $output .= ''; @@ -3315,9 +3408,17 @@ class NetworkMap $output .= '
mapOptions['width']; - $output .= ' ;height:'.$this->mapOptions['height'].'">'; - $output .= ''; + + if ($this->fullSize) { + $output .= ' width:100%'; + $output .= ' ;height: 100%">'; + $output .= ''; + } else { + $output .= ' width:'.$this->mapOptions['width'].'px'; + $output .= ' ;height:'.$this->mapOptions['height'].'px">'; + $output .= ''; + } + $output .= ''; $output .= '
'; } else { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 8c2bb2d844..9f9bfd9f2b 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,8 +20,8 @@ /** * Pandora build version and version */ -$build_version = 'PC190412'; -$pandora_version = 'v7.0NG.733'; +$build_version = 'PC190424'; +$pandora_version = 'v7.0NG.734'; // Do not overwrite default timezone set if defined. $script_tz = @date_default_timezone_get(); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index ea18c90d3f..7266e9eff4 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -583,8 +583,22 @@ define('NETWORKMAP_DEFAULT_HEIGHT', 800); // Discovery task types. define('DISCOVERY_HOSTDEVICES', 0); define('DISCOVERY_HOSTDEVICES_CUSTOM', 1); -define('DISCOVERY_CLOUD_AWS', 10); -define('DISCOVERY_APP_VMWARE', 100); +define('DISCOVERY_CLOUD_AWS', 2); +define('DISCOVERY_APP_VMWARE', 3); +define('DISCOVERY_APP_MYSQL', 4); +define('DISCOVERY_APP_ORACLE', 5); +define('DISCOVERY_CLOUD_AWS_EC2', 6); +define('DISCOVERY_CLOUD_AWS_RDS', 7); + + +// Discovery types matching definition. +define('DISCOVERY_SCRIPT_HOSTDEVICES_CUSTOM', 0); +// Standard applications. +define('DISCOVERY_SCRIPT_APP_VMWARE', 1); +// Cloud environments. +define('DISCOVERY_SCRIPT_CLOUD_AWS', 2); +define('DISCOVERY_SCRIPT_IPAM_RECON', 3); +define('DISCOVERY_SCRIPT_IPMI_RECON', 4); // Discovery task descriptions. define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2'); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 7903533d74..3d162c1a8b 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -559,7 +559,6 @@ $module_field_column_mampping = [ 'module_critical_inverse' => 'critical_inverse as module_critical_inverse', 'module_warning_inverse' => 'warning_inverse as module_warning_inverse', ]; - // module related field mappings 2/2 (output field => column for 'tagente_estado') // module_id_agent_modulo is not in this list $estado_fields_to_columns_mapping = [ @@ -14729,3 +14728,365 @@ function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3) } } + + +/** + * Functions por get all user to new feature for Carrefour + * It depends of returnType, the method will return csv or json data + * + * @param string $thrash1 don't use + * @param string $thrash2 don't use + * @param array $other don't use + * *@param string $returnType + * Example: + * api.php?op=get&op2=list_all_user&return_type=json&apipass=1234&user=admin&pass=pandora + * @return + */ + + +function api_get_list_all_user($thrash1, $thrash2, $other, $returnType) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AR')) { + returnError('forbidden', 'string'); + return; + } + + $sql = 'SELECT + tup.id_usuario AS user_id, + tu.fullname AS fullname, + tp.id_perfil AS profile_id, + tup.id_up AS id_up, + tp.name AS profile_name, + tup.id_grupo AS group_id, + tgp.nombre AS group_name + FROM tperfil tp + INNER JOIN tusuario_perfil tup + ON tp.id_perfil = tup.id_perfil + LEFT OUTER JOIN tgrupo tgp + ON tup.id_grupo = tgp.id_grupo + LEFT OUTER JOIN tusuario tu + ON tu.id_user = tup.id_usuario'; + + $users = db_get_all_rows_sql($sql); + + $i = 0; + + foreach ($users as $up) { + $group_name = $up['group_name']; + if ($up['group_name'] === null) { + $group_name = 'All'; + } + + $values[$i] = [ + 'id_usuario' => $up['user_id'], + 'fullname' => $up['fullname'], + 'id_up' => $up['id_up'], + 'id_perfil' => $up['profile_id'], + 'perfil_name' => $up['profile_name'], + 'id_grupo' => $up['group_id'], + 'group_name' => $group_name, + ]; + $i += 1; + } + + if ($values === false) { + returnError('Error_user', __('Users could not be found.')); + return; + } + + $data = [ + 'type' => 'array', + 'data' => $values, + ]; + + returnData($returnType, $data, ';'); +} + + +/** + * Funtion for get all info user to new feature for Carrefour + * It depends of returnType, the method will return csv or json data + * + * @param string $thrash1 don't use + * @param string $thrash2 don't use + * @param array $other other[0] = user database + * @param string $returnType + * Example + * api.php?op=get&op2=info_user_name&return_type=json&other=admin&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora + * + * @return + */ + + +function api_get_info_user_name($thrash1, $thrash2, $other, $returnType) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AR')) { + returnError('forbidden', 'string'); + return; + } + + $sql = sprintf( + 'SELECT tup.id_usuario AS user_id, + tu.fullname AS fullname, + tup.id_up AS id_up, + tp.id_perfil AS profile_id, + tp.name AS profile_name, + tup.id_grupo AS group_id, + tg.nombre AS group_name + FROM tperfil tp + INNER JOIN tusuario_perfil tup + ON tp.id_perfil = tup.id_perfil + LEFT OUTER JOIN tgrupo tg + ON tup.id_grupo = tg.id_grupo + LEFT OUTER JOIN tusuario tu + ON tu.id_user = tup.id_usuario + WHERE tup.id_usuario = "%s"', + io_safe_output($other['data'][0]) + ); + + $user_profile = db_get_all_rows_sql($sql); + + $i = 0; + + foreach ($user_profile as $up) { + $group_name = $up['group_name']; + if ($up['group_name'] === null) { + $group_name = 'All'; + } + + $values[$i] = [ + 'id_usuario' => $up['user_id'], + 'fullname' => $up['fullname'], + 'id_up' => $up['id_up'], + 'id_perfil' => $up['profile_id'], + 'perfil_name' => $up['profile_name'], + 'id_grupo' => $up['group_id'], + 'group_name' => $group_name, + ]; + $i += 1; + } + + $data = [ + 'type' => 'array', + 'data' => $values, + ]; + + returnData($returnType, $data, ';'); +} + + +/** + * Function for get user from a group to new feature for Carrefour. + * It depends of returnType, the method will return csv or json data. + * + * @param string $thrash1 don't use + * @param string $thrash2 don't use + * @param array $other + * $other[0] = id group + * $other[1] = is disabled or not + * @param string $returnType + * Example + * api.php?op=get&op2=filter_user_group&return_type=json&other=0|0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora + * + * @return + */ + + +function api_get_filter_user_group($thrash1, $thrash2, $other, $returnType) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AR')) { + returnError('forbidden', 'string'); + return; + } + + $filter = ''; + + if ($other['data'][0] !== '' && $other['data'][1] !== '') { + $filter = 'WHERE tup.id_grupo = '.$other['data'][0].' AND tu.disabled = '.$other['data'][1].''; + } else if ($other['data'][0] !== '') { + $filter = 'WHERE tup.id_grupo = '.$other['data'][0].''; + } else if ($other['data'][1] !== '') { + $filter = 'WHERE tu.disabled = '.$other['data'][1].''; + } + + $sql = sprintf( + 'SELECT DISTINCT + tup.id_usuario AS user_id, + tu.fullname AS fullname, + tup.id_up AS id_up, + tp.id_perfil AS profile_id, + tp.name AS profile_name, + tup.id_grupo AS group_id, + tg.nombre AS group_name + FROM tperfil tp + INNER JOIN tusuario_perfil tup + ON tp.id_perfil = tup.id_perfil + LEFT OUTER JOIN tgrupo tg + ON tup.id_grupo = tg.id_grupo + LEFT OUTER JOIN tusuario tu + ON tu.id_user = tup.id_usuario + '.$filter.'' + ); + + $filter_user = db_get_all_rows_sql($sql); + + $i = 0; + + foreach ($filter_user as $up) { + $group_name = $up['group_name']; + if ($up['group_name'] === null) { + $group_name = 'All'; + } + + $values[$i] = [ + 'id_usuario' => $up['user_id'], + 'fullname' => $up['fullname'], + 'id_up' => $up['id_up'], + 'id_perfil' => $up['profile_id'], + 'perfil_name' => $up['profile_name'], + 'id_grupo' => $up['group_id'], + 'group_name' => $group_name, + ]; + $i += 1; + } + + $data = [ + 'type' => 'array', + 'data' => $values, + ]; + + returnData($returnType, $data, ';'); + +} + + +/** + * Function for delete an user permission for Carrefour new feature + * The return of this function its only a message + * + * @param string $thrash1 don't use + * @param string $thrash2 don't use + * @param array $other + * $other[0] = id up + * @param string $returnType + * Example + * api.php?op=set&op2=delete_user_permission&return_type=json&other=user|2&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora + * + * @return void + */ + + +function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AW')) { + returnError('forbidden', 'string'); + return; + } + + if ($other['data'][0] != '') { + $values = [ + 'id_up' => io_safe_output($other['data'][0]), + ]; + } else { + returnError('Error_delete', __('User profile could not be deleted.')); + return; + } + + $deleted_permission = db_process_sql_delete('tusuario_perfil', $values); + + if ($deleted_permission == false) { + returnError('Error_delete', __('User profile could not be deleted.')); + return; + } + + $data = [ + 'type' => 'string', + 'data' => $deleted_permission, + ]; + + returnData('string', ['type' => 'string', 'data' => $data]); +} + + +/** + * Function for add permission a user to a group for Carrefour new feature + * It depends of returnType, the method will return csv or json data + * + * @param string $thrash1 don't use + * @param string $thrash2 don't use + * @param array $other other[0] = user database + * other[1] = id group + * other[2] = id profile + * other[3] = no_hierarchy ( 0 or 1, if empty = 0) + * other[4] = id from tusuario_perfil table (optional) + * * @param string $returnType + * Example + * api.php?op=set&op2=add_permission_user_to_group&return_type=json&other=admin|0|1|1|20&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora + * + * @return void + */ + + +function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AW')) { + returnError('forbidden', 'string'); + return; + } + + $sql = 'SELECT id_up + FROM tusuario_perfil + WHERE id_up = '.$other['data'][4].''; + + $exist_profile = db_get_value_sql($sql); + + if ($other['data'][3] < 0 || $other['data'][3] > 1) { + returnError('Error_insert', __('User profile could not be available.')); + return; + } + + if ($other['data'][3] == null) { + $other['data'][3] = 0; + } + + $values = [ + 'id_usuario' => $other['data'][0], + 'id_perfil' => $other['data'][2], + 'id_grupo' => $other['data'][1], + 'no_hierarchy' => $other['data'][3], + 'assigned_by' => $config['id_user'], + 'id_policy' => 0, + 'tags' => '', + + ]; + + $where_id_up = ['id_up' => $other['data'][4]]; + if ($exist_profile === $other['data'][4] && $where_id_up !== null) { + $sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up); + } else { + $sucessfull_insert = db_process_sql_insert('tusuario_perfil', $values); + } + + if ($sucessfull_insert == false) { + returnError('Error_insert', __('User profile could not be available.')); + return; + } + + $data = [ + 'type' => 'array', + 'data' => $values, + ]; + + returnData($returnType, $data, ';'); + +} diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 0cf2991630..3df7a65afd 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -513,34 +513,81 @@ function filemanager_file_explorer( ?> width = '100%'; $table->id = 'table_filemanager'; if (!defined('METACONSOLE')) { - $table->class = 'databox data'; + $table->class = 'info_table'; $table->title = ''.__('Index of %s', $relative_directory).''; } if (defined('METACONSOLE')) { $table->class = 'databox_tactical'; - $table->title = ''.__('Index of images').''; + $table->title = ''.__('Index of %s', $relative_directory).''; } $table->colspan = []; @@ -582,13 +629,6 @@ function filemanager_file_explorer( $table->head[2] = __('Last modification'); $table->head[3] = __('Size'); $table->head[4] = __('Actions'); - if (!defined('METACONSOLE')) { - $table->headstyle[0] = 'background-color:#82B92E'; - $table->headstyle[1] = 'background-color:#82B92E'; - $table->headstyle[2] = 'background-color:#82B92E'; - $table->headstyle[3] = 'background-color:#82B92E'; - $table->headstyle[4] = 'background-color:#82B92E'; - } $prev_dir = explode('/', $relative_directory); $prev_dir_str = ''; @@ -608,85 +648,6 @@ function filemanager_file_explorer( $table->colspan[0][1] = 5; } - if (is_writable($real_directory)) { - $table->rowstyle[1] = 'display: none;'; - $table->data[1][0] = ''; - $table->data[1][1] = ''; - - $table->data[1][1] .= ''; - - $table->data[1][1] .= ''; - - $table->data[1][1] .= ''; - - $table->colspan[1][1] = 5; - } - foreach ($files as $fileinfo) { $fileinfo['realpath'] = str_replace('\\', '/', $fileinfo['realpath']); $relative_path = str_replace($_SERVER['DOCUMENT_ROOT'], '', $fileinfo['realpath']); @@ -812,13 +773,44 @@ function filemanager_file_explorer( if (!$readOnly) { if (is_writable($real_directory)) { // The buttons to make actions - if (defined('METACONSOLE')) { - echo "
"; - } else { - echo "
"; - } + $tabs_dialog = ''; - echo ""; + echo ''; + + echo ''; + + echo ' '; + + echo "'; } else { - echo "
"; + echo "
"; echo "".__('The directory is read-only'); echo '
'; } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 30b86478f8..ef7debe089 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -436,7 +436,9 @@ function html_print_select_groups( $keys_field='id_grupo', $strict_user=false, $delete_groups=false, - $include_groups=false + $include_groups=false, + $size=false, + $simple_multiple_options=false ) { global $config; @@ -481,7 +483,12 @@ function html_print_select_groups( $class, $disabled, $style, - $option_style + $option_style, + $size, + false, + '', + false, + $simple_multiple_options ); if ($return) { @@ -529,7 +536,8 @@ function html_print_select( $size=false, $modal=false, $message='', - $select_all=false + $select_all=false, + $simple_multiple_options=false ) { $output = "\n"; @@ -557,6 +565,14 @@ function html_print_select( } } + if ($simple_multiple_options === true) { + if ($size !== false) { + $attributes .= ' size="'.$size.'"'; + } else { + $attributes .= ' size="10"'; + } + } + if (!empty($class)) { $attributes .= ' class="'.$class.'"'; } @@ -1774,7 +1790,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $ */ function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='') { - $output = ''; diff --git a/pandora_console/include/functions_reporting_xml.php b/pandora_console/include/functions_reporting_xml.php index 0179a27b06..91e3288d83 100644 --- a/pandora_console/include/functions_reporting_xml.php +++ b/pandora_console/include/functions_reporting_xml.php @@ -50,7 +50,7 @@ function reporting_xml_get_report($report, $filename, $return=false) } // Download if marked to download. - if ($filename === false) { + if ($filename !== false) { header('Content-Type: application/xml; charset=UTF-8'); header('Content-Disposition: attachment; filename="'.$filename.'.xml"'); } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index fd68b77e54..496a7b747f 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -54,10 +54,15 @@ function snmp_browser_print_tree( $last=0, $last_array=[], $sufix=false, - $checked=[] + $checked=[], + $return=false, + $descriptive_ids=false, + $previous_id='' ) { static $url = false; + $output = ''; + // Get the base URL for images. if ($url === false) { $url = ui_get_full_url('operation/tree', false, false, false); @@ -73,9 +78,9 @@ function snmp_browser_print_tree( $last_array[$depth] = $last; if ($depth > 0) { - echo "
'.__('Name').''.__('Description').''.__('Delete').'