From bb2d908de724b4af9cdd3c9864b13d24e37d8727 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 17 Jan 2024 12:25:57 +0100 Subject: [PATCH] #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 ''; } 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; }