From ea4b24de2e8b8c15a9616c9370961d87e2511d85 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Fri, 22 Feb 2019 10:54:17 +0100 Subject: [PATCH] Fixed ad advanced perms params saving Former-commit-id: a0aa5b3b666b0a990dfb087029f6e0bb2929292e --- pandora_console/include/functions_config.php | 32 ++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 714005f821..3316c13239 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -2089,9 +2089,9 @@ function config_process_config() if (!isset($config['ad_adv_perms'])) { config_update_value('ad_adv_perms', ''); } else { + $temp_ad_adv_perms = []; if (!json_decode(io_safe_output($config['ad_adv_perms']))) { - $temp_ad_adv_perms = []; - if (!isset($config['ad_adv_perms']) && $config['ad_adv_perms'] != '') { + if ($config['ad_adv_perms'] != '') { $perms = explode(';', io_safe_output($config['ad_adv_perms'])); foreach ($perms as $ad_adv_perm) { if (preg_match('/[\[\]]/', $ad_adv_perm)) { @@ -2154,22 +2154,26 @@ function config_process_config() if (!empty($new_ad_adv_perms)) { $temp_ad_adv_perms = json_encode($new_ad_adv_perms); } + } else { + $temp_ad_adv_perms = ''; } - - config_update_value('ad_adv_perms', $temp_ad_adv_perms); + } else { + $temp_ad_adv_perms = $config['ad_adv_perms']; } + + config_update_value('ad_adv_perms', $temp_ad_adv_perms); } if (!isset($config['ldap_adv_perms'])) { config_update_value('ldap_adv_perms', ''); } else { + $temp_ldap_adv_perms = []; if (!json_decode(io_safe_output($config['ldap_adv_perms']))) { - $temp_ldap_adv_perms = []; - if (!isset($config['ad_adv_perms']) && $config['ldap_adv_perms'] != '') { + if ($config['ldap_adv_perms'] != '') { $perms = explode(';', io_safe_output($config['ldap_adv_perms'])); - foreach ($perms as $ad_adv_perm) { - if (preg_match('/[\[\]]/', $ad_adv_perm)) { - $all_data = explode(',', io_safe_output($ad_adv_perm)); + foreach ($perms as $ldap_adv_perm) { + if (preg_match('/[\[\]]/', $ldap_adv_perm)) { + $all_data = explode(',', io_safe_output($ldap_adv_perm)); $profile = $all_data[0]; $group_pnd = $all_data[1]; $groups_ad = str_replace(['[', ']'], '', $all_data[2]); @@ -2199,7 +2203,7 @@ function config_process_config() 'groups_ldap' => $groups_ldap, ]; } else { - $all_data = explode(',', io_safe_output($ad_adv_perm)); + $all_data = explode(',', io_safe_output($ldap_adv_perm)); $profile = $all_data[0]; $group_pnd = $all_data[1]; $groups_ad = $all_data[2]; @@ -2228,10 +2232,14 @@ function config_process_config() if (!empty($new_ldap_adv_perms)) { $temp_ldap_adv_perms = json_encode($new_ldap_adv_perms); } + } else { + $temp_ldap_adv_perms = ''; } - - config_update_value('ldap_adv_perms', $temp_ldap_adv_perms); + } else { + $temp_ldap_adv_perms = $config['ldap_adv_perms']; } + + config_update_value('ldap_adv_perms', $temp_ldap_adv_perms); } if (!isset($config['rpandora_server'])) {