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