Merge branch 'ent-2530-bug-tokens-webserver-module' into 'develop'

Fixed tokens htpp_auth user,avoid repetiton

See merge request artica/pandorafms!3734
This commit is contained in:
Daniel Rodriguez 2021-03-01 09:53:55 +00:00
commit 1767712c72
1 changed files with 34 additions and 15 deletions

View File

@ -1570,6 +1570,16 @@ if ($update_module) {
'module_macros' => $module_macros,
];
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$http_user_conf = true;
}
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
$http_pass_conf = true;
}
if (!$http_user_conf || !$http_pass_conf) {
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
@ -1578,10 +1588,18 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
if ($http_user_conf) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
}
if ($http_pass) {
if ($http_user_pass) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
@ -1591,6 +1609,7 @@ if ($update_module) {
}
}
}
}
// In local modules, the interval is updated by agent.
$module_kind = (int) get_parameter('moduletype');