Changeset 4504
- Timestamp:
- 05/25/11 12:40:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/contactcenter/inc/hook_config_validate.inc.php
r4500 r4504 20 20 21 21 /* Check all settings to validate input. Name must be 'final_validation' */ 22 function final_validation( $value='')22 function final_validation(&$value='') 23 23 { 24 24 $error = false; 25 25 26 if($value['cc_global_source0'] == 'ldap') 27 { 28 if (!$value['cc_ldap_host0']) 29 { 30 $error[] = '<br>LDAP host must be set!'; 26 // if($value['cc_global_source0'] == 'ldap') 27 // { 28 // if (!$value['cc_ldap_host0']) 29 // { 30 // $error[] = '<br>LDAP host must be set!'; 31 // } 32 // 33 // if(!$value['cc_ldap_context0']) 34 // { 35 // $error[] = '<br>There must be a Context'; 36 // } 37 // 38 // if(!$value['cc_ldap_browse_dn0']) 39 // { 40 // $error[] = '<br>The Browse Account must be set'; 41 // } 42 // } 43 44 foreach ($value as $attr_name => $attr_value) { 45 if ($attr_value == '') { 46 $v = explode("_", $attr_name); 47 $nums[] = $v[3]; 31 48 } 49 } 50 51 foreach ($nums as $num) { 52 //Deleta toda a tupla que contem o atributo vazio 53 foreach ($value as $attr_name_x => $attr_value_x) { 32 54 33 if(!$value['cc_ldap_context0']) 34 { 35 $error[] = '<br>There must be a Context'; 55 if (strpos($attr_name_x, $num) !== false) { 56 if (strpos($attr_name_x, 'cc_attribute_name') !== false) 57 $error[] = "<br/>" . lang("Could not find the LDAP attribute pointed by") . " " . $attr_value_x; 58 59 unset($value[$attr_name_x]); 60 61 } 36 62 } 37 38 if(!$value['cc_ldap_browse_dn0'])39 {40 $error[] = '<br>The Browse Account must be set';41 }42 63 } 43 64 … … 51 72 /* 52 73 * @function cc_allow_details 53 * @abstract Recebe o valor do checkbox e for ï¿œa a saï¿œda para TRUE ou FALSE74 * @abstract Recebe o valor do checkbox e força a saída para TRUE ou FALSE 54 75 * @author Prognus software livre - http://www.prognus.com.br | prognus@prognus.com.br 55 76 * @param $value … … 62 83 } 63 84 } 85 86 87 88 /* 89 * @function cc_attribute_ldapname 90 * @abstract valida campo "Correspondente LDAP" se é um campo ldap válido 91 * @author Prognus Software Livre - http://www.prognus.com.br | prognus@prognus.com.br 92 * @param $value 93 */ 94 function cc_attribute_ldapname(&$value) { 95 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 96 $ds = $GLOBALS['phpgw']->common->ldapConnect($ldap->srcs[1]['host'], $ldap->srcs[1]['acc'], $ldap->srcs[1]['pw'], true); 97 $dn=$ldap->srcs[1]['dn']; 98 $justThese = array('uid', 'cn', $value); 99 $sr = ldap_search($ds, $dn, "($value=*)", $justThese, 0, 1); 100 $info = ldap_get_entries($ds, $sr); 101 102 if (!$info) 103 $value = ""; 104 ldap_close($ds); 105 } 64 106 ?>
Note: See TracChangeset
for help on using the changeset viewer.