#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,
];
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
if (!isset($_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 '<br/> <br/>';
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 (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
if (isset($config['logged']) === true) {
if ($config['logged'] == false) {
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) {
$show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
if ($ipam !== false) {
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1435,7 +1435,7 @@ function custom_fields_macros_report($macro, $key_macro)
$macro['server_id']
);
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']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if (isset($parameters['no_sortable_columns']) === true) {
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
}
}
}
@ -4234,7 +4236,7 @@ function ui_print_datatable(array $parameters)
}
$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.
$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']);
foreach ($data as $key => $dataset) {
$dataSet = $chart->createDataSet();
$dataSet->setLabel($dataset['label']);
$dataSet->setLabel((isset($dataset['label']) === true) ? $dataset['label'] : '');
$dataSet->setBackgroundColor($dataset['backgroundColor']);
$dataSet->setBorderColor($dataset['borderColor']);
$dataSet->setPointBackgroundColor($dataset['pointBackgroundColor']);
$dataSet->setPointBorderColor($dataset['pointBorderColor']);
$dataSet->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']);
$dataSet->setPointBorderColor((isset($dataset['pointBorderColor']) === true) ? $dataset['pointBorderColor'] : '');
$dataSet->setPointHoverBackgroundColor((isset($dataset['pointHoverBackgroundColor']) === true) ? $dataset['pointHoverBackgroundColor'] : '');
$dataSet->setPointHoverBorderColor($dataset['pointHoverBorderColor']);
$dataSet->data()->exchangeArray($dataset['data']);
$chart->addDataSet($dataSet);

View File

@ -144,9 +144,11 @@ class GeneralTacticalView
{
$js = '<script>';
foreach ($this->elements as $key => $element) {
if ($element->interval > 0) {
foreach ($element->refreshConfig as $key => $conf) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");';
if (isset($element->interval) === true) {
if ($element->interval > 0) {
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()
{
global $config;
parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php';

View File

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

View File

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

View File

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

View File

@ -156,6 +156,10 @@ class ScheduledDowntime extends Element
'cron_interval_from',
'cron_interval_to',
];
if (isset($config['user']) === false) {
$config['user'] = '';
}
$groups = implode(',', array_keys(users_get_groups($config['user'])));
$columns_str = implode(',', $columns);
$sql = sprintf(
@ -170,49 +174,51 @@ class ScheduledDowntime extends Element
);
$sql_count = 'SELECT COUNT(id) AS num
FROM tplanned_downtime';
FROM tplanned_downtime';
$downtimes = db_get_all_rows_sql($sql);
foreach ($downtimes as $key => $downtime) {
if ((int) $downtime['executed'] === 0) {
$downtimes[$key]['running'] = html_print_div(
if ($downtimes !== false) {
foreach ($downtimes as $key => $downtime) {
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' => '',
'class' => 'square stop',
'title' => 'Not running',
],
true
);
} else {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square running',
'title' => 'Running',
],
true
'title' => __('Agents and modules affected'),
'class' => 'main_menu_icon invert_filter',
]
);
$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);

View File

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

View File

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

View File

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