#12695 wip removing warnings

This commit is contained in:
Jonathan 2024-02-13 17:06:48 +01:00
parent 7f580cc388
commit da2bef45f2
6 changed files with 221 additions and 41 deletions

View File

@ -784,8 +784,36 @@ class HostDevices extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
} else {
$this->task['interval_sweep'] = '';
}
if (isset($this->task['name']) === false) {
$this->task['name'] = '';
}
if (isset($this->task['id_recon_server']) === false) {
$this->task['id_recon_server'] = '';
}
if (isset($this->task['subnet_csv']) === false) {
$this->task['subnet_csv'] = '';
}
if (isset($this->task['subnet']) === false) {
$this->task['subnet'] = '';
}
if (isset($this->task['id_group']) === false) {
$this->task['id_group'] = 0;
}
if (isset($this->task['description']) === false) {
$this->task['description'] = '';
}
$form['rows'][0]['new_form_block'] = true;

View File

@ -104,6 +104,20 @@ class Wizard
*/
public $rootUrl;
/**
* Task.
*
* @var mixed
*/
public $task;
/**
* Max pages net scan.
*
* @var mixed
*/
public $maxPagesNetScan;
/**
* Setter for breadcrum
@ -221,6 +235,10 @@ class Wizard
$i = 0;
foreach ($urls as $url) {
if (isset($url['selected']) === false) {
$url['selected'] = 0;
}
if ($url['selected'] == 1) {
$class = 'selected';
} else {

View File

@ -452,7 +452,7 @@ class CustomNetScan extends Wizard
'label' => __('Task name'),
'arguments' => [
'name' => 'taskname',
'value' => $this->task['name'],
'value' => (isset($this->task['name']) === true) ? $this->task['name'] : '',
'type' => 'text',
'size' => 50,
],
@ -474,7 +474,7 @@ class CustomNetScan extends Wizard
'label' => __('Comment'),
'arguments' => [
'name' => 'comment',
'value' => $this->task['description'],
'value' => (isset($this->task['description']) === true) ? $this->task['description'] : '',
'type' => 'text',
'size' => 50,
],
@ -496,7 +496,7 @@ class CustomNetScan extends Wizard
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'selected' => (isset($this->task['id_recon_server']) === true) ? $this->task['id_recon_server'] : '',
'return' => true,
],
];
@ -509,7 +509,7 @@ class CustomNetScan extends Wizard
'returnAllGroup' => false,
'privilege' => $this->access,
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'selected' => (isset($this->task['id_group']) === true) ? $this->task['id_group'] : '',
'return' => true,
'size' => '400px',
],
@ -517,8 +517,10 @@ class CustomNetScan extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
}
// Schedule.
@ -541,7 +543,7 @@ class CustomNetScan extends Wizard
],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
(isset($this->task['interval_sweep']) === true) ? $this->task['interval_sweep'] : '',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',

View File

@ -622,6 +622,10 @@ class HTML
public static function printBlockAsGrid(array $input, bool $return=false)
{
$output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
@ -632,6 +636,14 @@ class HTML
$class = $input['class'].$class;
}
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (isset($input['block_class']) === false) {
$input['block_class'] = '';
}
if (is_array($input['block_content']) === true) {
if (empty($input['label']) === false) {
$output .= '<div class="label_select">';
@ -648,6 +660,18 @@ class HTML
$output .= '</ul></li>';
} else {
if (isset($input['arguments']['inline']) === false) {
$input['arguments']['inline'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if (isset($input['arguments']) === false) {
$input['arguments'] = '';
}
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
@ -733,6 +757,10 @@ class HTML
public static function printBlockAsList(array $input, bool $return=false)
{
$output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
@ -743,6 +771,10 @@ class HTML
$class = $input['class'].$class;
}
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
@ -753,6 +785,14 @@ class HTML
$output .= '</ul></li>';
} else {
if (isset($input['id']) === false) {
$input['id'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
@ -953,6 +993,42 @@ class HTML
{
$form = $data['form'];
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
$rows = $data['rows'];
$rawInputs = $data['rawInputs'];
$js = $data['js'];
@ -991,7 +1067,15 @@ class HTML
if (is_array($rows)) {
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if (isset($row['class']) === false) {
$row['class'] = '';
}
if (isset($row['style']) === false) {
$row['style'] = '';
}
if (isset($row['new_form_block']) === true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
@ -1019,30 +1103,38 @@ class HTML
// Toggle option.
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
if ($input['toggle'] === true) {
$output .= ui_print_toggle(
[
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'title' => $input['toggle_title'],
'id' => $input['toggle_id'],
'hidden_default' => $input['toggle_hidden_default'],
'content' => self::printBlockAsGrid(
$input,
true
),
'return' => true,
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'toggle_class' => $input['toggle_toggle_class'],
'main_class' => $input['toggle_main_class'],
'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
if (isset($input['arguments']) === true) {
if ($input['arguments']['type'] != 'submit') {
if (isset($input['toggle']) === true) {
if ($input['toggle'] === true) {
$output .= ui_print_toggle(
[
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'title' => $input['toggle_title'],
'id' => $input['toggle_id'],
'hidden_default' => $input['toggle_hidden_default'],
'content' => self::printBlockAsGrid(
$input,
true
),
'return' => true,
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'toggle_class' => $input['toggle_toggle_class'],
'main_class' => $input['toggle_main_class'],
'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else {
$output .= self::printBlockAsGrid($input, true);
$output_submit .= self::printBlockAsGrid($input, true);
}
} else {
$output_submit .= self::printBlockAsGrid($input, true);
@ -1093,6 +1185,34 @@ class HTML
*/
public static function printFormAsList(array $data, bool $return=false)
{
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
$form = $data['form'];
$inputs = $data['inputs'];
$rawInputs = $data['rawInputs'];
@ -1101,6 +1221,18 @@ class HTML
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
if (isset($form['enctype']) === false) {
$form['enctype'] = '';
}
$output_head = '<form class="discovery max_floating_element_size" id="'.$form['id'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
@ -1121,7 +1253,7 @@ class HTML
$output = '<div class="white_box pdd_15px">';
$output .= '<ul class="wizard">';
$output_submit = '';
foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') {
$output .= self::printBlockAsList($input, true);

View File

@ -593,7 +593,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$email = ui_print_truncate_text($args[1], 120);
@ -656,7 +656,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($template === false) {
continue;
break;
}
if (empty($args[1]) === false && (string) $args[1] !== '0') {
@ -777,7 +777,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$path = $args[1];
@ -817,7 +817,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$path = $args[1];

View File

@ -5858,9 +5858,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'textarea':
$output .= html_print_textarea(
$data['name'],
$data['rows'],
$data['columns'],
(isset($data['name']) === true) ? $data['name'] : '',
(isset($data['rows']) === true) ? $data['rows'] : '',
(isset($data['columns']) === true) ? $data['columns'] : '',
((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),