#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,11 +152,13 @@
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 (isset($config['logged']) === true) {
if ($config['logged'] == false) { if ($config['logged'] == false) {
if (session_status() === PHP_SESSION_ACTIVE) { if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy(); session_destroy();
} }
} }
}
?> ?>
</div> </div>

View File

@ -521,6 +521,7 @@ 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');
if ($ipam !== false) {
foreach ($ipam as $row) { foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) { if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true; $show_ipam = true;
@ -528,6 +529,7 @@ if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
} }
} }
} }
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) {
$menu_godmode['gextensions']['text'] = __('Admin tools'); $menu_godmode['gextensions']['text'] = __('Admin tools');

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,12 +4701,14 @@ function graph_nodata_image($options)
{ {
global $config; global $config;
if (isset($options['base64']) === true) {
if ($options['base64'] === true) { if ($options['base64'] === true) {
$dataImg = file_get_contents( $dataImg = file_get_contents(
$config['homedir'].'/images/image_problem_area_150.png' $config['homedir'].'/images/image_problem_area_150.png'
); );
return base64_encode($dataImg); return base64_encode($dataImg);
} }
}
$style = ''; $style = '';
if (isset($options['nodata_image']['width']) === true) { if (isset($options['nodata_image']['width']) === true) {

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,6 +4004,7 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order; $parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction; $parameters['order']['direction'] = $direction;
if (isset($parameters['no_sortable_columns']) === true) {
foreach ($parameters['no_sortable_columns'] as $key => $find) { foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search( $found = array_search(
$parameters['no_sortable_columns'][$key], $parameters['no_sortable_columns'][$key],
@ -4019,6 +4020,7 @@ function ui_print_datatable(array $parameters)
unset($parameters['no_sortable_columns'][$key]); unset($parameters['no_sortable_columns'][$key]);
} }
} }
}
$parameters['csvTextInfo'] = __('Export current page to CSV'); $parameters['csvTextInfo'] = __('Export current page to CSV');
$parameters['csvFileTitle'] = sprintf(__('export_%s_current_page_%s'), $table_id, date('Y-m-d')); $parameters['csvFileTitle'] = sprintf(__('export_%s_current_page_%s'), $table_id, date('Y-m-d'));
@ -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,12 +144,14 @@ class GeneralTacticalView
{ {
$js = '<script>'; $js = '<script>';
foreach ($this->elements as $key => $element) { foreach ($this->elements as $key => $element) {
if (isset($element->interval) === true) {
if ($element->interval > 0) { if ($element->interval > 0) {
foreach ($element->refreshConfig as $key => $conf) { foreach ($element->refreshConfig as $key => $conf) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");'; $js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");';
} }
} }
} }
}
$js .= '</script>'; $js .= '</script>';
return $js; return $js;

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,6 +59,7 @@ class MonitoringElements extends Element
$labels = []; $labels = [];
$data = []; $data = [];
if ($rows !== false) {
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
if (empty($row['name']) === true) { if (empty($row['name']) === true) {
continue; continue;
@ -66,6 +68,7 @@ class MonitoringElements extends Element
$labels[] = $this->controlSizeText($row['name']); $labels[] = $this->controlSizeText($row['name']);
$data[] = $row['total']; $data[] = $row['total'];
} }
}
$options = [ $options = [
'labels' => $labels, 'labels' => $labels,

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(
@ -173,6 +177,7 @@ class ScheduledDowntime extends Element
FROM tplanned_downtime'; FROM tplanned_downtime';
$downtimes = db_get_all_rows_sql($sql); $downtimes = db_get_all_rows_sql($sql);
if ($downtimes !== false) {
foreach ($downtimes as $key => $downtime) { foreach ($downtimes as $key => $downtime) {
if ((int) $downtime['executed'] === 0) { if ((int) $downtime['executed'] === 0) {
$downtimes[$key]['running'] = html_print_div( $downtimes[$key]['running'] = html_print_div(
@ -214,6 +219,7 @@ class ScheduledDowntime extends Element
); );
$downtimes[$key]['affected'] .= '</a>'; $downtimes[$key]['affected'] .= '</a>';
} }
}
$downtimes_number_res = db_get_all_rows_sql($sql_count); $downtimes_number_res = db_get_all_rows_sql($sql_count);
$downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0; $downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0;

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'] ?? '')
); );
if (isset($filter['regex']) === true) {
$regex = get_parameter( $regex = get_parameter(
'filter[regex]', 'filter[regex]',
(io_safe_output($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.'" />';
} }