From 7f4dc4fbe458b675a378b7e6813e908986eee0f1 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 11 Dec 2023 09:18:40 +0100 Subject: [PATCH 01/10] #12460 fixed log deprecated --- pandora_console/include/functions_api.php | 6 +++--- pandora_console/include/functions_ui.php | 4 ++++ .../include/lib/TacticalView/elements/NewsBoard.php | 2 ++ pandora_console/operation/events/events.php | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 8f5fb66f54..07b512f55c 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='') { $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='') { $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='') { global $config; if (defined('METACONSOLE')) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 5c9a7e90fc..4a0db88991 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -147,6 +147,10 @@ function ui_print_truncate_text( $text_html_decoded = io_safe_output($text); $text_has_entities = $text != $text_html_decoded; + if ($text_html_decoded === null) { + $text_html_decoded = ''; + } + if (mb_strlen($text_html_decoded, 'UTF-8') > ($numChars)) { // '/2' because [...] is in the middle of the word. $half_length = intval(($numChars - 3) / 2); diff --git a/pandora_console/include/lib/TacticalView/elements/NewsBoard.php b/pandora_console/include/lib/TacticalView/elements/NewsBoard.php index 3be2dd685f..a2a2b7faba 100644 --- a/pandora_console/include/lib/TacticalView/elements/NewsBoard.php +++ b/pandora_console/include/lib/TacticalView/elements/NewsBoard.php @@ -117,6 +117,8 @@ class NewsBoard extends Element $output .= ''; return $output; + } else { + return ''; } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index be5f6047e3..c924794d6d 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -505,7 +505,7 @@ if (is_ajax() === true) { } } - if (strlen($tmp->server_name) >= 10) { + if (strlen(($tmp->server_name ?? '')) >= 10) { $tmp->server_name = ui_print_truncate_text( $tmp->server_name, 10, From a31f964753fbbec4e5d0a692e084969bc274fcfa Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 27 Dec 2023 11:12:43 +0100 Subject: [PATCH 02/10] #12460 fixed deprecated --- pandora_console/include/functions_api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 07b512f55c..ba10227fa2 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')) { From bb2d908de724b4af9cdd3c9864b13d24e37d8727 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 17 Jan 2024 12:25:57 +0100 Subject: [PATCH 03/10] #12460 fixed deprecated log --- .../godmode/wizards/Applications.class.php | 14 ++++++++++++++ pandora_console/godmode/wizards/Custom.class.php | 14 ++++++++++++++ .../godmode/wizards/DiscoveryTaskList.class.php | 7 +++++++ pandora_console/godmode/wizards/Wizard.main.php | 2 +- pandora_console/include/api.php | 4 +++- pandora_console/include/auth/mysql.php | 2 +- pandora_console/include/functions_events.php | 3 ++- pandora_console/include/functions_ui.php | 6 +----- .../lib/TacticalView/elements/SnmpTraps.php | 12 ++++++++++-- pandora_console/operation/events/events.php | 6 +++--- 10 files changed, 56 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/wizards/Applications.class.php b/pandora_console/godmode/wizards/Applications.class.php index 7458aea872..29fee2e73a 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 41a177b3e3..9ddec3d9af 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 e831022c23..3a7628d8b9 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/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index a286b97fca..06276cb187 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -517,7 +517,7 @@ class Wizard public static function printBigButtonsList($list_data) { echo '
    '; - array_map('self::printBigButtonElement', $list_data); + array_map(['Wizard', 'printBigButtonElement'], $list_data); echo '
'; } 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 76a6458f32..0a132829bf 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -575,7 +575,7 @@ function get_user_info($user) function get_users($order='fullname', $filter=false, $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/functions_events.php b/pandora_console/include/functions_events.php index 747e5154ce..1f7a839e31 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6471,7 +6471,8 @@ function event_print_graph( ]; $color[] = '#82b92f'; } - } else { + } else if ((int) $num_intervals > 0) { + // We assume that if num_interval is 0, not exist events. $interval_length = (int) ($period / $num_intervals); $intervals = []; $intervals[0] = $start_utimestamp; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 4a0db88991..cbfe60d7db 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -147,11 +147,7 @@ function ui_print_truncate_text( $text_html_decoded = io_safe_output($text); $text_has_entities = $text != $text_html_decoded; - if ($text_html_decoded === null) { - $text_html_decoded = ''; - } - - if (mb_strlen($text_html_decoded, 'UTF-8') > ($numChars)) { + if (isset($text_html_decoded) === true && mb_strlen($text_html_decoded, 'UTF-8') > ($numChars)) { // '/2' because [...] is in the middle of the word. $half_length = intval(($numChars - 3) / 2); 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/operation/events/events.php b/pandora_console/operation/events/events.php index c924794d6d..976012720a 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -505,7 +505,7 @@ if (is_ajax() === true) { } } - if (strlen(($tmp->server_name ?? '')) >= 10) { + if (isset($tmp->server_name) === true && strlen($tmp->server_name) >= 10) { $tmp->server_name = ui_print_truncate_text( $tmp->server_name, 10, @@ -1216,7 +1216,7 @@ if (is_ajax() === true) { if (empty($tmp) === false && $regex !== '') { $regex_validation = false; foreach (json_decode(json_encode($tmp), true) as $key => $field) { - if (preg_match('/'.$regex.'/', $field)) { + if (isset($field) === true && preg_match('/'.$regex.'/', $field)) { $regex_validation = true; } } @@ -1234,7 +1234,7 @@ if (is_ajax() === true) { $data = array_values( array_filter( - $data, + ((is_array($data) === true) ? $data : []), function ($item) { return (bool) (array) $item; } From 209b4b3e8bbb2ec6c0dc7711395fa8b58b5f8298 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 17 Jan 2024 12:41:56 +0100 Subject: [PATCH 04/10] #12460 fixed deprecated in library phpchartjs --- .../vendor/artica/phpchartjs/src/Delegate/JsonSerializable.php | 2 +- .../vendor/artica/phpchartjs/src/Options/Elements.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/vendor/artica/phpchartjs/src/Delegate/JsonSerializable.php b/pandora_console/vendor/artica/phpchartjs/src/Delegate/JsonSerializable.php index abf59aa9f6..c689aae0ac 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Delegate/JsonSerializable.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Delegate/JsonSerializable.php @@ -15,7 +15,7 @@ trait JsonSerializable /** * @return array */ - public function jsonSerialize() + public function jsonSerialize():mixed { return array_map(function ($value) { if ($value instanceof JsonSerializableInterface) { diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Elements.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Elements.php index b63513bc23..4350718958 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Options/Elements.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Elements.php @@ -148,7 +148,7 @@ class Elements implements ArraySerializableInterface, JsonSerializable /** * @return array */ - public function jsonSerialize() + public function jsonSerialize():mixed { return $this->getArrayCopy(); } From 17056e4ac33cf26abbb74d360e37bd967196f111 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 22 Jan 2024 15:30:46 +0100 Subject: [PATCH 05/10] #12460 merge with 12643 --- pandora_console/operation/events/events.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 86a499762f..a668829d49 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1253,15 +1253,6 @@ if (is_ajax() === true) { ); } - $data = array_values( - array_filter( - ((is_array($data) === true) ? $data : []), - function ($item) { - return (bool) (array) $item; - } - ) - ); - $count = count($data); // RecordsTotal && recordsfiltered resultados totales. echo json_encode( [ From 7f604f0c8dccbb4795fcfaeae9e33af860dc4b42 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 23 Jan 2024 17:47:26 +0100 Subject: [PATCH 06/10] #12460 fixed deprecated --- pandora_console/include/graphs/functions_gd.php | 7 +++++++ .../include/lib/ClusterViewer/ClusterWizard.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/pandora_console/include/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php index e32e76222f..b34bed47f7 100755 --- a/pandora_console/include/graphs/functions_gd.php +++ b/pandora_console/include/graphs/functions_gd.php @@ -301,6 +301,13 @@ function gd_progress_bubble($width, $height, $progress, $title, $font, $out_of_l function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color) { + $x1 = (int) $x1; + $y1 = (int) $y1; + $x2 = (int) $x2; + $y2 = (int) $y2; + $radius = (int) $radius; + $color = (int) $color; + // Draw rectangle without corners imagefilledrectangle($im, ($x1 + $radius), $y1, ($x2 - $radius), $y2, $color); imagefilledrectangle($im, $x1, ($y1 + $radius), $x2, ($y2 - $radius), $color); diff --git a/pandora_console/include/lib/ClusterViewer/ClusterWizard.php b/pandora_console/include/lib/ClusterViewer/ClusterWizard.php index 3c4c4eb293..0c67cc64f9 100644 --- a/pandora_console/include/lib/ClusterViewer/ClusterWizard.php +++ b/pandora_console/include/lib/ClusterViewer/ClusterWizard.php @@ -113,6 +113,13 @@ class ClusterWizard extends \HTML */ private $agent; + /** + * Id of clusters. + * + * @var integer + */ + public $id; + /** * Builds a Cluster Wizard. From fd8d233cf88cf2195f1242bdd3f4528de07527c4 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 24 Jan 2024 13:28:43 +0100 Subject: [PATCH 07/10] #12460 fixed deprecated --- pandora_console/godmode/agentes/module_manager_editor.php | 2 +- .../godmode/agentes/module_manager_editor_plugin.php | 7 ++++++- pandora_console/godmode/wizards/HostDevices.class.php | 2 +- pandora_console/include/class/Diagnostics.class.php | 7 +++++++ pandora_console/include/class/NetworkMap.class.php | 2 +- pandora_console/include/functions.php | 6 +++++- pandora_console/include/functions_io.php | 4 +--- 7 files changed, 22 insertions(+), 8 deletions(-) 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_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/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/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 9d4a3b2901..898d9f5af9 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/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/functions.php b/pandora_console/include/functions.php index 7c1638f8fa..421d3e7725 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2925,6 +2925,10 @@ function delete_dir($dir) */ function is_image_data($data) { + if (isset($data) === false) { + return false; + } + return (substr($data, 0, 10) == 'data:image'); } @@ -2947,7 +2951,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_io.php b/pandora_console/include/functions_io.php index 445504b11c..dd8dd1f6dc 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -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', From 22598b4bc26f08bdba5e5b019da31a99081b156a Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 29 Jan 2024 17:31:19 +0100 Subject: [PATCH 08/10] #12460 fixed deprecated --- pandora_console/include/ajax/heatmap.ajax.php | 1 + .../include/class/OrderInterpreter.class.php | 7 +++++++ .../include/functions_forecast.php | 2 +- .../include/lib/Dashboard/Manager.php | 14 +++++++++++++ .../include/lib/Dashboard/Widget.php | 21 +++++++++++++++++++ .../lib/Dashboard/Widgets/AgentHive.php | 2 +- .../lib/Dashboard/Widgets/DataMatrix.php | 7 +++++++ .../lib/Dashboard/Widgets/ModulesByStatus.php | 7 +++++++ .../lib/Dashboard/Widgets/agent_module.php | 2 +- .../lib/Dashboard/Widgets/events_list.php | 14 +++++++++++++ .../include/lib/Dashboard/Widgets/heatmap.php | 6 +++--- pandora_console/views/dashboard/cell.php | 7 ++++++- 12 files changed, 83 insertions(+), 7 deletions(-) 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/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/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/lib/Dashboard/Manager.php b/pandora_console/include/lib/Dashboard/Manager.php index 670487081d..c5b75dcb4d 100644 --- a/pandora_console/include/lib/Dashboard/Manager.php +++ b/pandora_console/include/lib/Dashboard/Manager.php @@ -167,6 +167,20 @@ class Manager implements PublicLogin */ private $duplicateCellId; + /** + * Url + * + * @var string + */ + public $url; + + /** + * Widget + * + * @var Widget + */ + public $cWidget; + /** * Allowed methods to be called using AJAX request. * diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 5746bdb142..f8079571c4 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -65,6 +65,27 @@ class Widget */ private $dateTo; + /** + * Data cell + * + * @var array + */ + public $dataCell; + + /** + * Overflow scrollbar. + * + * @var boolean + */ + public $overflow_scrollbars; + + /** + * Position + * + * @var array + */ + public $position; + /** * Contructor widget. diff --git a/pandora_console/include/lib/Dashboard/Widgets/AgentHive.php b/pandora_console/include/lib/Dashboard/Widgets/AgentHive.php index 0e426ed08a..b393f786ec 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/AgentHive.php +++ b/pandora_console/include/lib/Dashboard/Widgets/AgentHive.php @@ -226,7 +226,7 @@ class AgentHive extends Widget 'name' => 'groups[]', 'returnAllGroup' => false, 'privilege' => 'AR', - 'selected' => explode(',', $values['groups'][0]), + 'selected' => (isset($values['groups'][0]) === true) ? explode(',', $values['groups'][0]) : [], 'return' => true, 'multiple' => true, 'required' => true, diff --git a/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php b/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php index 770a3152fe..337f33364e 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php +++ b/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php @@ -117,6 +117,13 @@ class DataMatrix extends Widget */ protected $cellId; + /** + * Position + * + * @var array + */ + public $size; + /** * Construct. diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index e490135734..767410c25b 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/views/dashboard/cell.php b/pandora_console/views/dashboard/cell.php index 5b4e7f311e..910e7a114b 100644 --- a/pandora_console/views/dashboard/cell.php +++ b/pandora_console/views/dashboard/cell.php @@ -34,7 +34,12 @@ if ($redraw === false) { $output .= '
'; $output .= '
'; -$options = json_decode($cellData['options'], true); +if (isset($cellData['options']) === true) { + $options = json_decode($cellData['options'], true); +} else { + $options = []; +} + if ($cellData['id_widget'] !== '0') { $output .= $options['title']; } else { From c0ad5476253eeabe95ede70f5dd43f316aa5a72b Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 30 Jan 2024 13:14:54 +0100 Subject: [PATCH 09/10] #12460 fixed deprecated --- .../extensions/realtime_graphs/ajax.php | 4 +- .../agentes/module_manager_editor_common.php | 4 +- .../include/class/AuditLog.class.php | 42 +++++++++++++++++++ .../include/class/CredentialStore.class.php | 2 +- .../include/class/SatelliteAgent.class.php | 28 +++++++++++++ .../include/functions_extensions.php | 2 +- .../include/functions_notifications.php | 2 +- .../Dashboard/Widgets/security_hardening.php | 2 +- .../views/dashboard/configurationWidgets.php | 2 +- 9 files changed, 79 insertions(+), 9 deletions(-) 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/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/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/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 94036c7ad8..1da01cd96a 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/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/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_notifications.php b/pandora_console/include/functions_notifications.php index 61330b66f7..b6acadc952 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -818,7 +818,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/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/views/dashboard/configurationWidgets.php b/pandora_console/views/dashboard/configurationWidgets.php index 68a51edbaa..24f2019f86 100644 --- a/pandora_console/views/dashboard/configurationWidgets.php +++ b/pandora_console/views/dashboard/configurationWidgets.php @@ -43,7 +43,7 @@ $form = [ 'extra' => 'novalidate', ]; -$js = 'tinymce.init({ +$js .= ' tinymce.init({ selector: "#textarea_text", plugins: "preview, searchreplace, table, nonbreaking, link, image", promotion: false, From f68615cba06e9a3e3647829ebab2a445574d16db Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 30 Jan 2024 17:00:38 +0100 Subject: [PATCH 10/10] #12460 fixed deprecated --- .../godmode/massive/massive_edit_modules.php | 2 +- pandora_console/godmode/tag/tag.php | 2 +- .../godmode/wizards/Wizard.main.php | 7 +++ .../include/class/CalendarManager.class.php | 7 +++ .../include/class/ExternalTools.class.php | 56 +++++++++++++++++++ pandora_console/include/functions_profile.php | 1 + .../include/functions_treeview.php | 2 +- .../operation/inventory/inventory.php | 2 +- .../lib/UpdateManager/UI/Manager.php | 2 +- 9 files changed, 76 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 9b11b86916..b1e63ff05d 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/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/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index f48a318c17..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 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/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/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 "