Fixed problems with AD

This commit is contained in:
m-lopez-f 2016-10-21 10:37:30 +02:00
parent 27de5f92f2
commit c59598969c
1 changed files with 57 additions and 11 deletions

View File

@ -52,10 +52,6 @@ function config_update_value ($token, $value) {
io_safe_output($value));
}
if ($token == 'ad_adv_perms') {
$value = io_safe_output($value);
}
if ($token == 'default_assign_tags') {
$value = ($value);
}
@ -1192,15 +1188,65 @@ function config_process_config () {
if (!isset ($config['ad_adv_perms'])) {
config_update_value ('ad_adv_perms', '');
}
else{
$temp_ad_adv_perms = array();
if (isset($config['ad_adv_perms'])) {
if (!empty($config['ad_adv_perms'])) {
$temp_ad_adv_perms = $config['ad_adv_perms'];
else {
if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
$temp_ad_adv_perms = array();
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)) {
$all_data = explode (",", io_safe_output($ad_adv_perm));
$profile = $all_data[0];
$group_pnd = $all_data[1];
$groups_ad = str_replace(array("[","]"), "", $all_data[2]);
$tags = str_replace(array("[","]"), "", $all_data[3]);
$groups_ad = explode('|', $groups_ad);
$tags_name = explode('|', $tags);
$tags_ids = array();
foreach ($tags_name as $tag) {
$tags_ids[] = tags_get_id($tag);
}
$profile = profile_get_profiles(
array(
"name" => io_safe_input($profile)));
if (!$profile)
continue;
$profile_id = array_keys($profile);
$id_grupo = groups_get_id (io_safe_input($group_pnd), false);
$new_ad_adv_perms[] =
array('profile' => $profile_id[0],
'group' => array($id_grupo),
'tags' => $tags_ids,
'groups_ad' => $groups_ad);
}
else {
$all_data = explode (",", io_safe_output($ad_adv_perm));
$profile = $all_data[0];
$group_pnd = $all_data[1];
$groups_ad = $all_data[2];
$tags = $all_data[3];
$profile = profile_get_profiles(
array(
"name" => io_safe_input($profile)));
if (!$profile)
continue;
$profile_id = array_keys($profile);
$id_grupo = groups_get_id (io_safe_input($group_pnd), false);
$new_ad_adv_perms[] =
array('profile' => $profile_id[0],
'group' => array($id_grupo),
'tags' => array($tags),
'groups_ad' => array($groups_ad));
}
}
if (!empty($new_ad_adv_perms)) {
$temp_ad_adv_perms = json_encode($new_ad_adv_perms);
}
}
config_update_value ('ad_adv_perms', $temp_ad_adv_perms);
}
$config['ad_adv_perms'] = $temp_ad_adv_perms;
$keysConfig = array_keys($config);
}
if (!isset ($config['rpandora_server'])) {