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.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_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/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/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/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 "