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

View File

@ -521,12 +521,14 @@ 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');
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;
}
}
}
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) {

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,12 +4701,14 @@ function graph_nodata_image($options)
{
global $config;
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 = '';
if (isset($options['nodata_image']['width']) === true) {

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,6 +4004,7 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction;
if (isset($parameters['no_sortable_columns']) === true) {
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
@ -4019,6 +4020,7 @@ function ui_print_datatable(array $parameters)
unset($parameters['no_sortable_columns'][$key]);
}
}
}
$parameters['csvTextInfo'] = __('Export current page to CSV');
$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['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,12 +144,14 @@ class GeneralTacticalView
{
$js = '<script>';
foreach ($this->elements as $key => $element) {
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().'");';
}
}
}
}
$js .= '</script>';
return $js;

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

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