services php8
This commit is contained in:
parent
7ebd6a5f74
commit
3b6f5bd02f
|
@ -498,10 +498,10 @@ class HTML
|
|||
}
|
||||
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<li id="li-'.($input['block_id'] ?? '').'" class="'.$class.'">';
|
||||
|
||||
if (isset($input['wrapper']) === true) {
|
||||
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<'.$input['wrapper'].' id="'.($input['block_id'] ?? '').'" class="'.$class.'">';
|
||||
}
|
||||
|
||||
if (!$direct) {
|
||||
|
@ -551,9 +551,10 @@ class HTML
|
|||
|
||||
$output .= '</li>';
|
||||
} else {
|
||||
if ($input['arguments']['type'] != 'hidden'
|
||||
&& $input['arguments']['type'] != 'hidden_extended'
|
||||
&& $input['arguments']['type'] != 'datalist'
|
||||
if (is_array(($input['arguments'] ?? false)) === true
|
||||
&& ($input['arguments']['type'] ?? false) != 'hidden'
|
||||
&& ($input['arguments']['type'] ?? false) != 'hidden_extended'
|
||||
&& ($input['arguments']['type'] ?? false) != 'datalist'
|
||||
) {
|
||||
// Raw content for attach at the start of the input.
|
||||
if (isset($input['surround_start']) === true) {
|
||||
|
@ -580,7 +581,7 @@ class HTML
|
|||
$output .= $input['surround_end'];
|
||||
}
|
||||
} else {
|
||||
$output .= self::printInput($input['arguments']);
|
||||
$output .= self::printInput(($input['arguments'] ?? []));
|
||||
// Allow dynamic content.
|
||||
$output .= ($input['extra'] ?? '');
|
||||
}
|
||||
|
|
|
@ -1528,7 +1528,7 @@ function agents_get_modules(
|
|||
// ----------------------------------------------------------
|
||||
foreach ($list_filter as $item) {
|
||||
$field = $item['field'];
|
||||
$value = $item['value'];
|
||||
$value = (string) $item['value'];
|
||||
|
||||
// Check <> operator
|
||||
$operatorDistin = false;
|
||||
|
|
|
@ -572,15 +572,14 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
|||
}
|
||||
|
||||
// If the user has ACLs on a gruop but not in his father,
|
||||
// we consider it as a son of group "all"
|
||||
if (!isset($groups[$group['parent']])) {
|
||||
// we consider it as a son of group "all".
|
||||
if (isset($groups[$group['parent']]) === false) {
|
||||
$group['parent'] = 0;
|
||||
}
|
||||
|
||||
if (is_array($tree[$group['parent']]) === false) {
|
||||
$str = $tree[$group['parent']];
|
||||
if (is_array(($tree[$group['parent']] ?? null)) === false) {
|
||||
$tree[$group['parent']] = [
|
||||
'nombre' => $tree[$group['parent']],
|
||||
'nombre' => ($tree[$group['parent']] ?? ''),
|
||||
'id_grupo' => $group['parent'],
|
||||
];
|
||||
}
|
||||
|
@ -590,7 +589,7 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
|||
}
|
||||
|
||||
// Depends on the All group we give different format.
|
||||
if (isset($groups[0])) {
|
||||
if (isset($groups[0]) === true) {
|
||||
$tree = [$tree[0]];
|
||||
} else {
|
||||
$tree = $tree[0]['branch'];
|
||||
|
@ -991,31 +990,31 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
|||
switch ($agent_status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
if (($total > 0) && ($critical == 0) && ($warning > 0)) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1026,23 +1025,23 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
|||
} else {
|
||||
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
// Invalid status
|
||||
|
@ -1846,8 +1845,12 @@ function groups_get_tree(&$groups, $parent=false)
|
|||
}
|
||||
|
||||
|
||||
function groups_get_tree_good(&$groups, $parent=false, &$childs)
|
||||
function groups_get_tree_good(&$groups, $parent, &$childs)
|
||||
{
|
||||
if (isset($parent) === false) {
|
||||
$parent = false;
|
||||
}
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach ($groups as $id => $group) {
|
||||
|
@ -1895,8 +1898,15 @@ function groups_get_tree_keys($groups, &$group_keys)
|
|||
}
|
||||
|
||||
|
||||
function group_get_data($id_user=false, $user_strict=false, $acltags, $returnAllGroup=false, $mode='group', $agent_filter=[], $module_filter=[])
|
||||
{
|
||||
function group_get_data(
|
||||
$id_user=false,
|
||||
$user_strict=false,
|
||||
$acltags=[],
|
||||
$returnAllGroup=false,
|
||||
$mode='group',
|
||||
$agent_filter=[],
|
||||
$module_filter=[]
|
||||
) {
|
||||
global $config;
|
||||
if ($id_user == false) {
|
||||
$id_user = $config['id_user'];
|
||||
|
|
|
@ -4598,7 +4598,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
$output .= ' class="'.$data['input_class'].'">';
|
||||
}
|
||||
|
||||
switch ($data['type']) {
|
||||
switch (($data['type'] ?? null)) {
|
||||
case 'text':
|
||||
$output .= html_print_input_text(
|
||||
$data['name'],
|
||||
|
@ -4650,15 +4650,15 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
|
||||
case 'text_extended':
|
||||
$output .= html_print_input_text_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['id'],
|
||||
$data['alt'],
|
||||
$data['size'],
|
||||
$data['maxlength'],
|
||||
$data['disabled'],
|
||||
$data['script'],
|
||||
$data['attributes'],
|
||||
($data['name'] ?? null),
|
||||
($data['value'] ?? null),
|
||||
($data['id'] ?? null),
|
||||
($data['alt'] ?? null),
|
||||
($data['size'] ?? null),
|
||||
($data['maxlength'] ?? null),
|
||||
($data['disabled'] ?? null),
|
||||
($data['script'] ?? null),
|
||||
($data['attributes'] ?? null),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['password']) === true) ? $data['password'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : '')
|
||||
|
@ -4868,7 +4868,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
case 'checkbox':
|
||||
$output .= html_print_checkbox(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
($data['value'] ?? null),
|
||||
((isset($data['checked']) === true) ? $data['checked'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
|
|
|
@ -352,11 +352,11 @@ class Agent extends Entity
|
|||
|
||||
$cps = 0;
|
||||
|
||||
if (is_array($direct_parents) === false) {
|
||||
if (is_array(($direct_parents ?? null)) === false) {
|
||||
$direct_parents = [];
|
||||
}
|
||||
|
||||
if (is_array($mc_parents) === false) {
|
||||
if (is_array(($mc_parents ?? null)) === false) {
|
||||
$mc_parents = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -1200,11 +1200,11 @@ class Module extends Entity
|
|||
|
||||
$cps = 0;
|
||||
|
||||
if (is_array($direct_parents) === false) {
|
||||
if (is_array(($direct_parents ?? null)) === false) {
|
||||
$direct_parents = [];
|
||||
}
|
||||
|
||||
if (is_array($mc_parents) === false) {
|
||||
if (is_array(($mc_parents ?? null)) === false) {
|
||||
$mc_parents = [];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue