diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index ee0f6d119d..4540647ff4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.775-240207 +Version: 7.0NG.775-240212 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 157318b744..f1bb519b3a 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.775-240207" +pandora_version="7.0NG.775-240212" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 417ff01de6..e32233b28d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.775'; -use constant AGENT_BUILD => '240207'; +use constant AGENT_BUILD => '240212'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 0daaad573f..72733d6131 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240207 +%define release 240212 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index f17d3385b7..586d2e851e 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240207 +%define release 240212 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index fd8eaa717c..3b7519d4e9 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240207 +%define release 240212 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 77ffa9603e..e4642d5e3b 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240207 +%define release 240212 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index df8a8298ab..596bb71efe 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240207 +%define release 240212 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 af838ca3e9..45b115904a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.775" -PI_BUILD="240207" +PI_BUILD="240212" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 20ceb59ecc..89f3ebefbc 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240207} +{240212} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 5d63022c43..69f5bb8200 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.775 Build 240207") +#define PANDORA_VERSION ("7.0NG.775 Build 240212") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index f4a25d4253..047164560c 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.775(Build 240207))" + VALUE "ProductVersion", "(7.0NG.775(Build 240212))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 6db9add67d..2085adac6e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.775-240207 +Version: 7.0NG.775-240212 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 da77fff309..0a0086ffb2 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.775-240207" +pandora_version="7.0NG.775-240212" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index 8b633171ab..1482540f91 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -128,6 +128,6 @@ if (empty($data)) { } echo '{ - "label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'", - "data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']] + "label": "'.htmlspecialchars(($graph_title ?? ''), ENT_QUOTES).'", + "data": [["'.time().'", '.htmlspecialchars(($data ?? ''), ENT_QUOTES).']] }'; diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index 83218087c1..5625973458 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -61,4 +61,11 @@ ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); +-- Update version for plugin oracle +UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; + +SET @widget_id = NULL; +SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap'; +INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php'); + COMMIT; \ No newline at end of file diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 130f31c79d..543d241fc9 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -150,7 +150,7 @@ if (is_ajax()) { $component = db_get_row('tlocal_component', 'id', $id_component); foreach ($component as $index => $element) { $component[$index] = html_entity_decode( - $element, + (isset($element) === true) ? $element : '', ENT_QUOTES, 'UTF-8' ); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 47c843f2d9..a9d809d29f 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -505,7 +505,7 @@ $tableBasicThresholds->data['caption_switch_warning_inverse_string'][0] = html_p $tableBasicThresholds->data['caption_warning_threshold'][0] .= '('.__('Str.').')'; $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( 'str_warning', - str_replace('"', '', $str_warning), + str_replace('"', '', (isset($str_warning) === true) ? $str_warning : ''), '', 10, 1024, @@ -602,7 +602,7 @@ $tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div( $tableBasicThresholds->data['caption_critical_threshold'][0] .= '('.__('Str.').')'; $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( 'str_critical', - str_replace('"', '', $str_critical), + str_replace('"', '', (isset($str_critical) === true) ? $str_critical : ''), '', 10, 1024, diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index 9b5d98c27d..abbbc4d9c1 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -60,7 +60,12 @@ $data[1] = html_print_select_from_sql( $disabledBecauseInPolicy ); // Store the macros in base64 into a hidden control to move between pages -$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true); +$data[1] .= html_print_input_hidden( + 'macros', + (isset($macros) === true) ? base64_encode($macros) : '', + true +); + $table_simple->colspan['plugin_1'][2] = 2; if (!empty($id_plugin)) { diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 82698266a1..9a57ef9d53 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -319,9 +319,8 @@ if ($update_agents) { $secondary_groups_removed ); - $agents_values = agents_get_agent((int) $array_id[1]); + $agents_values = db_get_row_filter('tagente', ['id_agente' => (int) $array_id[1]]); $node->disconnect(); - if (empty($values) === false) { update_agents_in_metaconsole( (int) $array_id[1], diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 79cd0233da..2b8990c065 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -1500,7 +1500,7 @@ $table->data[39][0] = html_print_label_input_block( '', '', true - ).html_print_input_hidden('macros', base64_encode($macros), true) + ).html_print_input_hidden('macros', base64_encode(($macros ?? '')), true) ); require_once $config['homedir'].'/include/class/CredentialStore.class.php'; diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 23a284caf9..1589f33fc9 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -115,7 +115,7 @@ foreach ($servers as $server) { $table->cellclass[] = [ 3 => 'progress_bar', - 8 => 'table_action_buttons', + 9 => 'table_action_buttons', ]; $data[0] = ''.strip_tags($server['name']).''; diff --git a/pandora_console/godmode/setup/os.builder.php b/pandora_console/godmode/setup/os.builder.php index 6313aa3edd..4f7b77099b 100644 --- a/pandora_console/godmode/setup/os.builder.php +++ b/pandora_console/godmode/setup/os.builder.php @@ -48,7 +48,7 @@ if ($idOS > 0) { } else { $name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name'))))); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description')))); - $icon = get_parameter('icon', 0); + $icon = get_parameter('icon', 'os@svg.svg'); } $icon_upload = get_parameter('icon_upload', null); @@ -246,7 +246,7 @@ $iconData[] = html_print_select( 'icon', $icon, 'show_icon_OS();', - __('None'), + '', 0, true ); @@ -356,6 +356,8 @@ function get_list_os_icons_dir() } } + $return['os@svg.svg'] = __('None'); + return $return; } diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index dcfe95ecdb..403232c868 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -88,6 +88,14 @@ switch ($tab) { break; case 'manage_os': + $id_os = get_parameter('id_os', ''); + if ($id_os !== '') { + $headerTitle = __('Edit OS'); + } else { + $headerTitle = __('Create OS'); + } + break; + case 'list': if ($action === 'edit') { $headerTitle = __('Edit OS'); diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index 220c6c244c..1bef19495e 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -386,7 +386,7 @@ if (empty($result) === false) { $data[4] = $output; $phone_large = io_safe_output($tag['phone']); - $phone_small = substr($phone_large, 0, 24); + $phone_small = substr(($phone_large ?? ''), 0, 24); if ($phone_large == $phone_small) { $output = $phone_large; } else { diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 668216d330..4269405476 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -1581,7 +1581,7 @@ $autorefresh_list_out['operation/events/events'] = 'Events'; if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) { $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'"); - $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + $autorefresh_list = json_decode(($select[0]['autorefresh_white_list'] ?? '')); if ($autorefresh_list === null || $autorefresh_list === 0) { $autorefresh_list = []; $autorefresh_list[0] = __('None'); diff --git a/pandora_console/godmode/wizards/Applications.class.php b/pandora_console/godmode/wizards/Applications.class.php index f92a8cf0d6..680630f86b 100644 --- a/pandora_console/godmode/wizards/Applications.class.php +++ b/pandora_console/godmode/wizards/Applications.class.php @@ -37,6 +37,20 @@ class Applications extends Wizard */ public $mode; + /** + * Task properties. + * + * @var array + */ + public $task; + + /** + * Class of styles. + * + * @var string + */ + public $class; + /** * Constructor. diff --git a/pandora_console/godmode/wizards/Custom.class.php b/pandora_console/godmode/wizards/Custom.class.php index 516b8d1e80..f721e76aa7 100644 --- a/pandora_console/godmode/wizards/Custom.class.php +++ b/pandora_console/godmode/wizards/Custom.class.php @@ -37,6 +37,20 @@ class Custom extends Wizard */ public $mode; + /** + * Task properties. + * + * @var array + */ + public $task; + + /** + * Class of styles. + * + * @var string + */ + public $class; + /** * Constructor. diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index d088e8c84f..4cebdfec9f 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -47,6 +47,13 @@ ui_require_javascript_file('simTree'); class DiscoveryTaskList extends HTML { + /** + * Task properties. + * + * @var array + */ + public $task; + /** * Constructor. diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 4f0043f038..08a47b12f8 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -1109,7 +1109,7 @@ class HostDevices extends Wizard 'return' => true, 'selected' => explode( ',', - $this->task['id_network_profile'] + (isset($this->task['id_network_profile']) === true) ? $this->task['id_network_profile'] : '' ), 'nothing_value' => 0, 'nothing' => __('None'), diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 0b95a31ac7..9eb223e744 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -97,6 +97,13 @@ class Wizard */ public $access = 'AR'; + /** + * Root url. + * + * @var string + */ + public $rootUrl; + /** * Setter for breadcrum @@ -550,7 +557,7 @@ class Wizard } echo '
'; if ($return === true) { diff --git a/pandora_console/images/widgets/GisMap.png b/pandora_console/images/widgets/GisMap.png new file mode 100644 index 0000000000..0cbfbf37b6 Binary files /dev/null and b/pandora_console/images/widgets/GisMap.png differ diff --git a/pandora_console/include/ajax/heatmap.ajax.php b/pandora_console/include/ajax/heatmap.ajax.php index 71020ad67f..83c7226388 100644 --- a/pandora_console/include/ajax/heatmap.ajax.php +++ b/pandora_console/include/ajax/heatmap.ajax.php @@ -250,6 +250,7 @@ if (is_ajax() === true) { if ($getInfo === true) { enterprise_include_once('include/functions_agents.php'); + include_once $config['homedir'].'/include/functions_graph.php'; $id = get_parameter('id', 0); $id_server = get_parameter('id_server', 0); if (empty($id_server) === false) { diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php index b29dd06bd3..4836f98c64 100644 --- a/pandora_console/include/api.php +++ b/pandora_console/include/api.php @@ -380,5 +380,7 @@ if (session_status() !== PHP_SESSION_DISABLED) { // Could give a warning if no session file is created. Ignore. @session_destroy(); header_remove('Set-Cookie'); - setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); + if (isset($_COOKIE[session_name()]) === true) { + setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); + } } diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 3141272352..a3c6bcc092 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -572,10 +572,10 @@ function get_user_info($user) * * @return array An array of user information */ -function get_users($order='fullname', $filter=false, $fields=false) +function get_users($order='fullname', $filter=[], $fields=false) { if (is_array($order) === true) { - $filter['order'] = $order['field'].' '.$order['order']; + $filter['order'] = (string) $order['field'].' '.(string) $order['order']; } else { if ($order !== 'registered' || $order !== 'last_connect' || $order !== 'fullname') { $order = 'fullname'; diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index ceb98875a1..a4988e8042 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -53,6 +53,48 @@ class AuditLog extends HTML */ private $ajaxController; + /** + * TableId + * + * @var integer + */ + public $tableId; + + /** + * FilterIp + * + * @var array + */ + public $filterIp; + + /** + * FilterPeriod + * + * @var integer + */ + public $filterPeriod; + + /** + * FilterText + * + * @var string + */ + public $filterText; + + /** + * FilterType + * + * @var string + */ + public $filterType; + + /** + * FilterUser + * + * @var string + */ + public $filterUser; + /** * Class constructor diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php index 560fb6f4ad..b5ef6456a7 100644 --- a/pandora_console/include/class/CalendarManager.class.php +++ b/pandora_console/include/class/CalendarManager.class.php @@ -66,6 +66,13 @@ class CalendarManager */ private $message; + /** + * Access + * + * @var string + */ + public $access; + /** * Allowed methods to be called using AJAX request. * diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index dd3f484d5e..5169af1009 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -850,7 +850,7 @@ class CredentialStore extends Wizard 'privilege' => 'AR', 'type' => 'select_groups', 'nothing' => false, - 'selected' => (defined($id_group_filter) ? $id_group_filter : 0), + 'selected' => ((isset($id_group_filter) === true) ? $id_group_filter : 0), 'return' => true, 'size' => '80%', ], diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 3f2c4cad22..714a6a707f 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -54,6 +54,13 @@ class Diagnostics extends Wizard */ public $pdf; + /** + * Product name. + * + * @var string + */ + public $product_name; + /** * Constructor. diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 7165a4fcbb..215a664cb2 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -38,6 +38,62 @@ require_once $config['homedir'].'/include/class/HTML.class.php'; class ExternalTools extends HTML { + /** + * Origin + * + * @var string + */ + public $origin; + + /** + * PathCustomComm + * + * @var string + */ + public $pathCustomComm; + + /** + * PathDig + * + * @var string + */ + public $pathDig; + + /** + * PathNmap + * + * @var string + */ + public $pathNmap; + + /** + * PathPing + * + * @var string + */ + public $pathPing; + + /** + * PathSnmpget + * + * @var string + */ + public $pathSnmpget; + + /** + * PathTraceroute + * + * @var string + */ + public $pathTraceroute; + + /** + * UpdatePaths + * + * @var string + */ + public $updatePaths; + /** * Constructor. diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 184e830e9c..3a8b947926 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -706,7 +706,7 @@ class NetworkMap */ public function setNodes($nodes) { - $this->nodes = $nodes; + $this->nodes = (array) $nodes; } diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index d41fbbf837..b96ad6e510 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -52,6 +52,13 @@ class OrderInterpreter extends Wizard */ public $ajaxController; + /** + * Pages menu + * + * @var array + */ + public $pages_menu; + /** * Generates a JSON error. diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index a40b3ecc7a..5dc149ffb4 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -67,6 +67,34 @@ class SatelliteAgent extends HTML */ private $ajaxController; + /** + * Satellite_name + * + * @var string + */ + public $satellite_name; + + /** + * Satellite_server + * + * @var string + */ + public $satellite_server; + + /** + * TableId + * + * @var integer + */ + public $tableId; + + /** + * Satellite_config + * + * @var string + */ + public $satellite_config; + /** * Class constructor diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 265c84b75c..96ef2f6752 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC240207'; +$build_version = 'PC240212'; $pandora_version = 'v7.0NG.775'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index cbd65315e8..1762326077 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2917,6 +2917,10 @@ function delete_dir($dir) */ function is_image_data($data) { + if (isset($data) === false) { + return false; + } + return (substr($data, 0, 10) == 'data:image'); } @@ -2939,7 +2943,7 @@ function is_snapshot_data($data) */ function is_text_to_black_string($data) { - if (is_image_data($data)) { + if (isset($data) === false || is_image_data($data)) { return false; } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 70990699a4..29feaa253f 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -541,7 +541,7 @@ function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) } -function api_get_agent_module_name_last_value($agentName, $moduleName, $other=';', $returnType) +function api_get_agent_module_name_last_value($agentName, $moduleName, $other=';', $returnType='string') { $idAgent = agents_get_agent_id($agentName); @@ -558,7 +558,7 @@ function api_get_agent_module_name_last_value($agentName, $moduleName, $other='; } -function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other=';', $returnType) +function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other=';', $returnType='string') { $sql = sprintf( 'SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo @@ -573,7 +573,7 @@ function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other= } -function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnType) +function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnType='string') { global $config; if (defined('METACONSOLE')) { diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index f381484461..0a40a38e5a 100755 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -440,7 +440,7 @@ function extensions_add_operation_menu_option($name, $fatherId=null, $icon=null, $option_menu['acl'] = $acl; $extension = &$config['extensions'][$extension_file]; - $option_menu['sec2'] = $extension['dir'].'/'.mb_substr($extension_file, 0, -4); + $option_menu['sec2'] = $extension['dir'].'/'.mb_substr(($extension_file ?? ''), 0, -4); $option_menu['fatherId'] = $fatherId; $option_menu['subfatherId'] = $subfatherId; $option_menu['icon'] = $icon; diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index 540bbf7174..1f0d1e59d9 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -100,7 +100,7 @@ function forecast_projection_graph( $data[0] = ''; $data[1] = $cont; - $data[2] = date($config['date_format'], $row[0]); + $data[2] = date($config['date_format'], (int) $row[0]); $data[3] = $row[0]; $data[4] = $row[1]; $data[5] = ($row[0] * $row[1]); diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index 445504b11c..cb6b5163ac 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -82,11 +82,11 @@ function io_safe_input($value) return $value; } - if (! mb_check_encoding($value, 'UTF-8')) { + if (isset($value) === true && !mb_check_encoding($value, 'UTF-8')) { $value = utf8_encode($value); } - $valueHtmlEncode = htmlentities($value, ENT_QUOTES, 'UTF-8', true); + $valueHtmlEncode = htmlentities(($value ?? ''), ENT_QUOTES, 'UTF-8', true); // Replace the character '\' for the equivalent html entitie $valueHtmlEncode = str_replace('\\', '\', $valueHtmlEncode); @@ -561,10 +561,8 @@ function io_output_password($password, $wrappedBy='') ] ); - $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext; - // If password already decrypt return same password. - $output = (empty($plaintext) === true) ? $password : $plaintext; + $output = (empty($plaintext) === true || $plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext; return sprintf( '%s%s%s', diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 141d3ae8cc..f16e8fd25b 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -819,7 +819,7 @@ function notifications_print_global_source_configuration($source) $html_checkboxes = ''; - $blacklist = json_decode($source['subtype_blacklist'], 1); + $blacklist = json_decode(($source['subtype_blacklist'] ?? ''), 1); if (json_last_error() !== JSON_ERROR_NONE) { $blacklist = []; } diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index d97edf17aa..278d39f9a6 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -243,6 +243,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $profile = json_decode($profile); } + $result = []; $result[] = [ 'id_grupo' => $profile->group, 'id_perfil' => $profile->profile, diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 66dad24db6..ada7841ab7 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -1039,7 +1039,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) echo " + + + values['gis_map']); + + $output .= ''; + gis_print_map( + 'map_'.$this->cellId, + $map['zoom_level'], + $map['initial_latitude'], + $map['initial_longitude'], + $baselayers, + $controls + ); + $output .= ''; + + if (empty($layers) === false) { + foreach ($layers as $layer) { + gis_make_layer( + $layer['layer_name'], + $layer['view_layer'], + null, + $layer['id_tmap_layer'] + ); + + // Calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB. + $agentNamesByGroup = []; + if ($layer['tgrupo_id_grupo'] >= 0) { + $agentNamesByGroup = agents_get_group_agents( + $layer['tgrupo_id_grupo'], + false, + 'none', + true, + true, + false + ); + } + + $agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']); + + $groupsByAgentId = gis_get_groups_layer_by_agent_id($layer['id_tmap_layer']); + $agentNamesOfGroupItems = []; + foreach ($groupsByAgentId as $agentId => $groupInfo) { + $agentNamesOfGroupItems[$agentId] = $groupInfo['agent_name']; + } + + $agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer + $agentNamesOfGroupItems); + + foreach ($agentNames as $key => $agentName) { + $idAgent = $key; + $coords = gis_get_data_last_position_agent($idAgent); + + if ($coords === false) { + $coords['stored_latitude'] = $map['default_latitude']; + $coords['stored_longitude'] = $map['default_longitude']; + } else { + if ($show_history == 'y') { + $lastPosition = [ + 'longitude' => $coords['stored_longitude'], + 'latitude' => $coords['stored_latitude'], + ]; + gis_add_path($layer['layer_name'], $idAgent, $lastPosition); + } + } + + $status = agents_get_status($idAgent, true); + $icon = gis_get_agent_icon_map($idAgent, true, $status); + $icon_size = getimagesize($icon); + $icon_width = $icon_size[0]; + $icon_height = $icon_size[1]; + + // Is a group item. + if (empty($groupsByAgentId[$idAgent]) === false) { + $groupId = (int) $groupsByAgentId[$idAgent]['id']; + $groupName = $groupsByAgentId[$idAgent]['name']; + + gis_add_agent_point( + $layer['layer_name'], + io_safe_output($groupName), + $coords['stored_latitude'], + $coords['stored_longitude'], + $icon, + $icon_width, + $icon_height, + $idAgent, + $status, + 'point_group_info', + $groupId + ); + } else { + $parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent); + + gis_add_agent_point( + $layer['layer_name'], + io_safe_output($agentName), + $coords['stored_latitude'], + $coords['stored_longitude'], + $icon, + $icon_width, + $icon_height, + $idAgent, + $status, + 'point_agent_info', + $parent + ); + } + } + } + + gis_add_parent_lines(); + + $timestampLastOperation = db_get_value_sql('SELECT UNIX_TIMESTAMP()'); + + gis_activate_select_control(); + gis_activate_ajax_refresh($layers, $timestampLastOperation); + } + + return $output; + } + + + /** + * Get description. + * + * @return string. + */ + public static function getDescription() + { + return __('GIS map'); + } + + + /** + * Get Name. + * + * @return string. + */ + public static function getName() + { + return 'GisMap'; + } + + + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 500, + 'height' => 300, + ]; + + return $size; + } + + +} diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index 69c0a36f44..1bbcc3be33 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -115,6 +115,13 @@ class ModulesByStatus extends Widget */ protected $cellId; + /** + * Size + * + * @var array + */ + public $size; + /** * Construct. diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php index 56ab854375..f5c4ff5a96 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php @@ -355,7 +355,7 @@ class AgentModuleWidget extends Widget */ public function getIdCacheAgent($id_agents) { - $target_agents = explode(',', $id_agents); + $target_agents = explode(',', ($id_agents ?? '')); $cache_id_agents = []; foreach ($target_agents as $agent_id) { if (str_contains($agent_id, '|') === false) { diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index a50cab93e4..beb7a92b5f 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -111,6 +111,20 @@ class EventsListWidget extends Widget */ protected $publicLink; + /** + * Overflow scrollbar. + * + * @var boolean + */ + public $overflow_scrollbars; + + /** + * Position + * + * @var array + */ + public $position; + /** * Construct. diff --git a/pandora_console/include/lib/Dashboard/Widgets/heatmap.php b/pandora_console/include/lib/Dashboard/Widgets/heatmap.php index e199a80ad8..ada804bedb 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/heatmap.php +++ b/pandora_console/include/lib/Dashboard/Widgets/heatmap.php @@ -271,7 +271,7 @@ class HeatmapWidget extends Widget 'name' => 'groups[]', 'returnAllGroup' => true, 'privilege' => 'AR', - 'selected' => explode(',', $values['groups'][0]), + 'selected' => (isset($values['groups'][0]) === true) ? explode(',', $values['groups'][0]) : [], 'return' => true, 'multiple' => true, ], @@ -305,7 +305,7 @@ class HeatmapWidget extends Widget 'type' => 'select', 'fields' => $tags, 'name' => 'tags[]', - 'selected' => explode(',', $values['tags'][0]), + 'selected' => (isset($values['tags'][0]) === true) ? explode(',', $values['tags'][0]) : [], 'return' => true, 'multiple' => true, ], @@ -332,7 +332,7 @@ class HeatmapWidget extends Widget 'type' => 'select', 'fields' => $module_groups, 'name' => 'module_groups[]', - 'selected' => explode(',', $values['module_groups'][0]), + 'selected' => (isset($values['module_groups'][0]) === true) ? explode(',', $values['module_groups'][0]) : [], 'return' => true, 'multiple' => true, 'nothing' => __('Not assigned'), diff --git a/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php b/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php index 9f7d726677..88e37c58b5 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php +++ b/pandora_console/include/lib/Dashboard/Widgets/security_hardening.php @@ -446,7 +446,7 @@ class SecurityHardening extends Widget { global $config; - $id_groups = explode(',', $group); + $id_groups = explode(',', ($group ?? '')); if (in_array(0, $id_groups) === true) { $id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false)); } diff --git a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php index f606893429..9e1de4d891 100644 --- a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php +++ b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php @@ -83,7 +83,11 @@ class SnmpTraps extends Element { if ($this->isEnabled() === true) { $value = $this->valueMonitoring('snmp_trap_queue'); - $total = round($value[0]['data']); + if (isset($value[0]['data']) === true) { + $total = round($value[0]['data']); + } else { + $total = __('N/A'); + } } else { $total = __('N/A'); } @@ -109,7 +113,11 @@ class SnmpTraps extends Element { if ($this->isEnabled() === true) { $value = $this->valueMonitoring('total_trap'); - $total = round($value[0]['data']); + if (isset($value[0]['data']) === true) { + $total = round($value[0]['data']); + } else { + $total = __('N/A'); + } } else { $total = __('N/A'); } diff --git a/pandora_console/install.php b/pandora_console/install.php index 5b2aec429c..d3ae55cd59 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@