Fixed tokens htpp_auth user,avoid repetiton

This commit is contained in:
Luis Calvo 2020-12-17 17:42:53 +01:00
parent b5d52a5afe
commit a8ab897d44
1 changed files with 34 additions and 15 deletions

View File

@ -1570,24 +1570,43 @@ if ($update_module) {
'module_macros' => $module_macros, 'module_macros' => $module_macros,
]; ];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$plugin_parameter_split = explode('
', $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_conf || !$http_pass_conf) {
if ($http_user) { if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
'; $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.'
';
} }
} }
} }