#12695 WIP warnings

This commit is contained in:
Jonathan 2024-02-07 16:39:33 +01:00
parent 834635a487
commit 2246fd8049
20 changed files with 135 additions and 88 deletions

View File

@ -161,6 +161,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
'code' => false, 'code' => false,
]; ];
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
if (!isset($_GET['sec2'])) { if (!isset($_GET['sec2'])) {
$_GET['sec2'] = ''; $_GET['sec2'] = '';
} }

View File

@ -152,9 +152,11 @@
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.'); echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>'; echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name()); echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
if ($config['logged'] == false) { if (isset($config['logged']) === true) {
if (session_status() === PHP_SESSION_ACTIVE) { if ($config['logged'] == false) {
session_destroy(); if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
}
} }
} }
?> ?>

View File

@ -521,10 +521,12 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$show_ipam = false; $show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network'); $ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) { if ($ipam !== false) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) { foreach ($ipam as $row) {
$show_ipam = true; if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
break; $show_ipam = true;
break;
}
} }
} }
} }

View File

@ -214,7 +214,8 @@ class ManageExtensions extends HTML
break; break;
default: default:
continue; // Nothing.
break;
} }
} }

View File

@ -2190,7 +2190,8 @@ class ExtensionsDiscovery extends Wizard
break; break;
default: default:
continue; // Nothing.
break;
} }
if ($value !== false) { if ($value !== false) {

View File

@ -376,10 +376,6 @@ class WelcomeWindow extends Wizard
'class' => 'modal', 'class' => 'modal',
]; ];
if (enterprise_installed() === true) {
$logo_url = ENTERPRISE_DIR.'/'.$logo_url;
}
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$flag_um = false; $flag_um = false;
$flag_cm = false; $flag_cm = false;
@ -768,6 +764,10 @@ class WelcomeWindow extends Wizard
], ],
true true
); );
if (isset($agents_num) === false) {
$agents_num = '';
}
echo html_print_label_input_block( echo html_print_label_input_block(
__('Number of agents to be created'), __('Number of agents to be created'),
html_print_div( html_print_div(
@ -893,6 +893,10 @@ class WelcomeWindow extends Wizard
__('Agent'), __('Agent'),
ui_print_agent_autocomplete_input($params) ui_print_agent_autocomplete_input($params)
); );
if (isset($modules) === false) {
$modules = '';
}
echo html_print_label_input_block( echo html_print_label_input_block(
__('Module'), __('Module'),
html_print_select( html_print_select(

View File

@ -4701,11 +4701,13 @@ function graph_nodata_image($options)
{ {
global $config; global $config;
if ($options['base64'] === true) { if (isset($options['base64']) === true) {
$dataImg = file_get_contents( if ($options['base64'] === true) {
$config['homedir'].'/images/image_problem_area_150.png' $dataImg = file_get_contents(
); $config['homedir'].'/images/image_problem_area_150.png'
return base64_encode($dataImg); );
return base64_encode($dataImg);
}
} }
$style = ''; $style = '';

View File

@ -144,7 +144,7 @@ function config_wiz_modal(
'UTC' => __('UTC'), 'UTC' => __('UTC'),
]; ];
if ($zone_selected == '') { if (isset($zone_selected) === false) {
if ($config['timezone'] != '') { if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']); $zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0]; $zone_selected = $zone_array[0];

View File

@ -1435,7 +1435,7 @@ function custom_fields_macros_report($macro, $key_macro)
$macro['server_id'] $macro['server_id']
); );
if (metaconsole_connect($server) != NOERR) { if (metaconsole_connect($server) != NOERR) {
continue; break;
} }
} }

View File

@ -4004,19 +4004,21 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order; $parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction; $parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) { if (isset($parameters['no_sortable_columns']) === true) {
$found = array_search( foreach ($parameters['no_sortable_columns'] as $key => $find) {
$parameters['no_sortable_columns'][$key], $found = array_search(
$columns_tmp $parameters['no_sortable_columns'][$key],
); $columns_tmp
);
if ($found !== false) { if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]); unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found); array_push($parameters['no_sortable_columns'], $found);
} }
if (is_int($parameters['no_sortable_columns'][$key]) === false) { if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]); unset($parameters['no_sortable_columns'][$key]);
}
} }
} }
@ -4234,7 +4236,7 @@ function ui_print_datatable(array $parameters)
} }
$parameters['phpDate'] = date('Y-m-d'); $parameters['phpDate'] = date('Y-m-d');
$parameters['dataElements'] = json_encode($parameters['data_element']); $parameters['dataElements'] = (isset($parameters['data_element']) === true) ? json_encode($parameters['data_element']) : '';
// * START JAVASCRIPT. // * START JAVASCRIPT.
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js'; $file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';

View File

@ -1355,12 +1355,12 @@ function get_build_setup_charts($type, $options, $data)
$chart->labels()->exchangeArray($options['labels']); $chart->labels()->exchangeArray($options['labels']);
foreach ($data as $key => $dataset) { foreach ($data as $key => $dataset) {
$dataSet = $chart->createDataSet(); $dataSet = $chart->createDataSet();
$dataSet->setLabel($dataset['label']); $dataSet->setLabel((isset($dataset['label']) === true) ? $dataset['label'] : '');
$dataSet->setBackgroundColor($dataset['backgroundColor']); $dataSet->setBackgroundColor($dataset['backgroundColor']);
$dataSet->setBorderColor($dataset['borderColor']); $dataSet->setBorderColor($dataset['borderColor']);
$dataSet->setPointBackgroundColor($dataset['pointBackgroundColor']); $dataSet->setPointBackgroundColor($dataset['pointBackgroundColor']);
$dataSet->setPointBorderColor($dataset['pointBorderColor']); $dataSet->setPointBorderColor((isset($dataset['pointBorderColor']) === true) ? $dataset['pointBorderColor'] : '');
$dataSet->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']); $dataSet->setPointHoverBackgroundColor((isset($dataset['pointHoverBackgroundColor']) === true) ? $dataset['pointHoverBackgroundColor'] : '');
$dataSet->setPointHoverBorderColor($dataset['pointHoverBorderColor']); $dataSet->setPointHoverBorderColor($dataset['pointHoverBorderColor']);
$dataSet->data()->exchangeArray($dataset['data']); $dataSet->data()->exchangeArray($dataset['data']);
$chart->addDataSet($dataSet); $chart->addDataSet($dataSet);

View File

@ -144,9 +144,11 @@ class GeneralTacticalView
{ {
$js = '<script>'; $js = '<script>';
foreach ($this->elements as $key => $element) { foreach ($this->elements as $key => $element) {
if ($element->interval > 0) { if (isset($element->interval) === true) {
foreach ($element->refreshConfig as $key => $conf) { if ($element->interval > 0) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");'; foreach ($element->refreshConfig as $key => $conf) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");';
}
} }
} }
} }

View File

@ -34,6 +34,7 @@ class Agents extends Element
*/ */
public function __construct() public function __construct()
{ {
global $config;
parent::__construct(); parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php'; include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';

View File

@ -391,7 +391,8 @@ class Events extends Element
break; break;
default: default:
continue; // Nothing.
break;
} }
$labels[] = $this->controlSizeText($label); $labels[] = $this->controlSizeText($label);

View File

@ -73,6 +73,9 @@ class Groups extends Element
public function getStatusHeatMap():string public function getStatusHeatMap():string
{ {
global $config; global $config;
if (isset($config['id_group']) === false) {
$config['id_group'] = false;
}
$groups = users_get_groups($config['id_group'], 'AR', false); $groups = users_get_groups($config['id_group'], 'AR', false);
if (is_array($groups) === true && count($groups) >= 10) { if (is_array($groups) === true && count($groups) >= 10) {

View File

@ -34,6 +34,7 @@ class MonitoringElements extends Element
*/ */
public function __construct() public function __construct()
{ {
global $config;
parent::__construct(); parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php'; include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';
@ -58,13 +59,15 @@ class MonitoringElements extends Element
$labels = []; $labels = [];
$data = []; $data = [];
foreach ($rows as $key => $row) { if ($rows !== false) {
if (empty($row['name']) === true) { foreach ($rows as $key => $row) {
continue; if (empty($row['name']) === true) {
} continue;
}
$labels[] = $this->controlSizeText($row['name']); $labels[] = $this->controlSizeText($row['name']);
$data[] = $row['total']; $data[] = $row['total'];
}
} }
$options = [ $options = [

View File

@ -156,6 +156,10 @@ class ScheduledDowntime extends Element
'cron_interval_from', 'cron_interval_from',
'cron_interval_to', 'cron_interval_to',
]; ];
if (isset($config['user']) === false) {
$config['user'] = '';
}
$groups = implode(',', array_keys(users_get_groups($config['user']))); $groups = implode(',', array_keys(users_get_groups($config['user'])));
$columns_str = implode(',', $columns); $columns_str = implode(',', $columns);
$sql = sprintf( $sql = sprintf(
@ -170,49 +174,51 @@ class ScheduledDowntime extends Element
); );
$sql_count = 'SELECT COUNT(id) AS num $sql_count = 'SELECT COUNT(id) AS num
FROM tplanned_downtime'; FROM tplanned_downtime';
$downtimes = db_get_all_rows_sql($sql); $downtimes = db_get_all_rows_sql($sql);
foreach ($downtimes as $key => $downtime) { if ($downtimes !== false) {
if ((int) $downtime['executed'] === 0) { foreach ($downtimes as $key => $downtime) {
$downtimes[$key]['running'] = html_print_div( if ((int) $downtime['executed'] === 0) {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square stop',
'title' => 'Not running',
],
true
);
} else {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square running',
'title' => 'Running',
],
true
);
}
$downtimes[$key]['configuration'] = reporting_format_planned_downtime_dates($downtime);
$settings = [
'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Elements affected'),
'id' => $downtime['id'],
];
$downtimes[$key]['affected'] = '<a style="margin-left: 22px;" href="javascript:" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$downtimes[$key]['affected'] .= html_print_image(
'images/details.svg',
true,
[ [
'content' => '', 'title' => __('Agents and modules affected'),
'class' => 'square stop', 'class' => 'main_menu_icon invert_filter',
'title' => 'Not running', ]
],
true
);
} else {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square running',
'title' => 'Running',
],
true
); );
$downtimes[$key]['affected'] .= '</a>';
} }
$downtimes[$key]['configuration'] = reporting_format_planned_downtime_dates($downtime);
$settings = [
'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Elements affected'),
'id' => $downtime['id'],
];
$downtimes[$key]['affected'] = '<a style="margin-left: 22px;" href="javascript:" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$downtimes[$key]['affected'] .= html_print_image(
'images/details.svg',
true,
[
'title' => __('Agents and modules affected'),
'class' => 'main_menu_icon invert_filter',
]
);
$downtimes[$key]['affected'] .= '</a>';
} }
$downtimes_number_res = db_get_all_rows_sql($sql_count); $downtimes_number_res = db_get_all_rows_sql($sql_count);

View File

@ -1462,6 +1462,10 @@ if ($searchPage) {
// Make file path absolute to prevent accessing remote files. // Make file path absolute to prevent accessing remote files.
$file = __DIR__.'/'.$file; $file = __DIR__.'/'.$file;
// Translate some secs. // Translate some secs.
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
$main_sec = get_sec($_GET['sec']); $main_sec = get_sec($_GET['sec']);
$_GET['sec'] = ($main_sec == false) ? $_GET['sec'] : $main_sec; $_GET['sec'] = ($main_sec == false) ? $_GET['sec'] : $main_sec;

View File

@ -130,10 +130,15 @@ $severity = get_parameter(
'filter[severity]', 'filter[severity]',
($filter['severity'] ?? '') ($filter['severity'] ?? '')
); );
$regex = get_parameter( if (isset($filter['regex']) === true) {
'filter[regex]', $regex = get_parameter(
(io_safe_output($filter['regex']) ?? '') 'filter[regex]',
); (io_safe_output($filter['regex']) ?? '')
);
} else {
$regex = '';
}
unset($filter['regex']); unset($filter['regex']);
$status = get_parameter( $status = get_parameter(
'filter[status]', 'filter[status]',

View File

@ -26,6 +26,10 @@
* ============================================================================ * ============================================================================
*/ */
if (isset($preview) === false) {
$preview = '';
}
$output = ''; $output = '';
$output .= '<script>var idTips = ['.$id.'];</script>'; $output .= '<script>var idTips = ['.$id.'];</script>';
$output .= '<div class="window">'; $output .= '<div class="window">';
@ -58,7 +62,7 @@ if ($files !== false) {
} }
} }
if ($files64 !== false) { if (isset($files64) === true) {
foreach ($files64 as $key => $file) { foreach ($files64 as $key => $file) {
$output .= '<img src="'.$file.'" />'; $output .= '<img src="'.$file.'" />';
} }