mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-19 20:04:52 +02:00
Fix minor issues related with pandorawmic
This commit is contained in:
parent
4589a7c298
commit
275fd2ed19
@ -667,7 +667,7 @@ $table_other->data[$i++][1] = html_print_input_text(
|
|||||||
$config['wmiBinary'],
|
$config['wmiBinary'],
|
||||||
'',
|
'',
|
||||||
50,
|
50,
|
||||||
10,
|
50,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2814,7 +2814,7 @@ class AgentWizard extends HTML
|
|||||||
// Unpack the query filters.
|
// Unpack the query filters.
|
||||||
$queryFilters = json_decode($module['query_filters'], true);
|
$queryFilters = json_decode($module['query_filters'], true);
|
||||||
// Name of query filter field.
|
// Name of query filter field.
|
||||||
$fieldValueName = $fieldSet[$queryFilters['field']];
|
$fieldValueName = (empty($fieldSet[$queryFilters['field']]) === false) ? $fieldSet[$queryFilters['field']] : '1';
|
||||||
|
|
||||||
// Evaluate type of scan and execution.
|
// Evaluate type of scan and execution.
|
||||||
if ($module['scan_type'] == SCAN_TYPE_FIXED) {
|
if ($module['scan_type'] == SCAN_TYPE_FIXED) {
|
||||||
@ -2900,6 +2900,7 @@ class AgentWizard extends HTML
|
|||||||
$dataCombined = array_combine($columnsList, $rowList);
|
$dataCombined = array_combine($columnsList, $rowList);
|
||||||
// Change the macros for values.
|
// Change the macros for values.
|
||||||
foreach ($dataCombined as $macroKey => $macroValue) {
|
foreach ($dataCombined as $macroKey => $macroValue) {
|
||||||
|
$macroKey = trim($macroKey);
|
||||||
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
|
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
|
||||||
$valueOperation = preg_replace(
|
$valueOperation = preg_replace(
|
||||||
'/_'.$macroKey.'_/',
|
'/_'.$macroKey.'_/',
|
||||||
@ -3003,6 +3004,7 @@ class AgentWizard extends HTML
|
|||||||
);
|
);
|
||||||
// Change the macros for values.
|
// Change the macros for values.
|
||||||
foreach ($dataCombined as $macroKey => $macroValue) {
|
foreach ($dataCombined as $macroKey => $macroValue) {
|
||||||
|
$macroKey = trim($macroKey);
|
||||||
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
|
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
|
||||||
$valueOperation = preg_replace(
|
$valueOperation = preg_replace(
|
||||||
'/_'.$macroKey.'_/',
|
'/_'.$macroKey.'_/',
|
||||||
@ -3030,39 +3032,48 @@ class AgentWizard extends HTML
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the final table with all of data received.
|
// If we not retrieve information (P.E. connection refused).
|
||||||
foreach ($moduleBlocks as $module) {
|
if (empty($moduleBlocks) === true) {
|
||||||
// Prepare the blocks. If its new, create a new index.
|
$this->message['type'][] = 'warning';
|
||||||
if (key_exists($module['group'], $blockTables) === false) {
|
$this->message['message'][] = __(
|
||||||
$blockTables[$module['group']] = [
|
'No information could be retrieved.'
|
||||||
'name' => $module['group_name'],
|
);
|
||||||
'data' => [],
|
$this->showMessage();
|
||||||
];
|
} else {
|
||||||
|
// Create the final table with all of data received.
|
||||||
|
foreach ($moduleBlocks as $module) {
|
||||||
|
// Prepare the blocks. If its new, create a new index.
|
||||||
|
if (key_exists($module['group'], $blockTables) === false) {
|
||||||
|
$blockTables[$module['group']] = [
|
||||||
|
'name' => $module['group_name'],
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the module info in the block.
|
||||||
|
$blockTables[$module['group']]['data'][] = $module;
|
||||||
|
if (isset($blockTables[$module['group']]['activeModules']) === false
|
||||||
|
&& (int) $module['module_enabled'] === 1
|
||||||
|
) {
|
||||||
|
$blockTables[$module['group']]['activeModules'] = 2;
|
||||||
|
} else if (isset($blockTables[$module['group']]['activeModules']) === true
|
||||||
|
&& (int) $module['module_enabled'] === 0
|
||||||
|
) {
|
||||||
|
$blockTables[$module['group']]['activeModules'] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the module info in the block.
|
// General Default monitoring.
|
||||||
$blockTables[$module['group']]['data'][] = $module;
|
html_print_div(
|
||||||
if (isset($blockTables[$module['group']]['activeModules']) === false
|
[
|
||||||
&& (int) $module['module_enabled'] === 1
|
'class' => 'wizard wizard-result',
|
||||||
) {
|
'style' => 'margin-top: 20px;',
|
||||||
$blockTables[$module['group']]['activeModules'] = 2;
|
'content' => $this->toggleTableModules($blockTables),
|
||||||
} else if (isset($blockTables[$module['group']]['activeModules']) === true
|
]
|
||||||
&& (int) $module['module_enabled'] === 0
|
);
|
||||||
) {
|
// Add Create Modules form.
|
||||||
$blockTables[$module['group']]['activeModules'] = 1;
|
$this->createModulesForm();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// General Default monitoring.
|
|
||||||
html_print_div(
|
|
||||||
[
|
|
||||||
'class' => 'wizard wizard-result',
|
|
||||||
'style' => 'margin-top: 20px;',
|
|
||||||
'content' => $this->toggleTableModules($blockTables),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
// Add Create Modules form.
|
|
||||||
$this->createModulesForm();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5544,13 +5555,13 @@ class AgentWizard extends HTML
|
|||||||
string $unit='',
|
string $unit='',
|
||||||
?int $type=0
|
?int $type=0
|
||||||
) {
|
) {
|
||||||
|
$output = '';
|
||||||
try {
|
try {
|
||||||
// Avoid non-numeric or arithmetic chars for security reasons.
|
// Avoid non-numeric or arithmetic chars for security reasons.
|
||||||
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
||||||
throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
|
throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
|
||||||
} else {
|
} else {
|
||||||
// Get the result of the operation and set it.
|
// Get the result of the operation and set it.
|
||||||
$output = '';
|
|
||||||
eval('$output = '.$operation.';');
|
eval('$output = '.$operation.';');
|
||||||
// If this module has unit, attach to current value.
|
// If this module has unit, attach to current value.
|
||||||
$output = $this->replacementUnit(
|
$output = $this->replacementUnit(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user