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,24 +1570,43 @@ if ($update_module) {
'module_macros' => $module_macros,
];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$http_user_conf = true;
}
$values['plugin_parameter'] = '';
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
$http_pass_conf = true;
}
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
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']);
$values['plugin_parameter'] = '';
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.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
}
$values['plugin_parameter'] .= $value.'
';
} else {
$values['plugin_parameter'] .= $value.'
';
}
}
}