IcingaObjectFieldForm: fix proposed fields for...

...commands with multiple arguments in their parameters
This commit is contained in:
Thomas Gelf 2016-03-05 15:49:49 +01:00
parent 6560864b4e
commit d990abf0df
1 changed files with 10 additions and 7 deletions

View File

@ -54,7 +54,9 @@ class IcingaObjectFieldForm extends DirectorObjectForm
if ($arg->argument_format === 'string') {
$val = $arg->argument_value;
// TODO: create var::extractMacros or so
if (preg_match('/^\$[^\$]+\$$/', $val)) {
if (preg_match_all('/(\$[a-z0-9_]+\$)/', $val, $m, PREG_PATTERN_ORDER)) {
foreach ($m[1] as $val) {
if (array_key_exists($val, $blacklistedVars)) {
$id = $blacklistedVars[$val];
$suggestedFields[$id] = $existingFields[$id];
@ -66,6 +68,7 @@ class IcingaObjectFieldForm extends DirectorObjectForm
}
}
}
}
// Prepare combined fields array
$fields = array();