Changeset 3456 for branches/2.2/preferences/changepersonaldata.php
- Timestamp:
- 11/04/10 11:05:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/preferences/changepersonaldata.php
r3299 r3456 39 39 40 40 $GLOBALS['phpgw']->template->set_var('lang_commercial_telephonenumber',lang('%1 telephone number',lang('Commercial'))); 41 $GLOBALS['phpgw']->template->set_var('lang_birthday',lang('Birthday')); 41 42 $GLOBALS['phpgw']->template->set_var('lang_ps_commercial_telephonenumber', 42 43 lang('Observation') . ': ' . lang('This telephone number will apear in searches for your name, and it will be visible for all ExpressoLivre Users') . '.'); … … 46 47 $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); 47 48 $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepersonaldata.php')); 48 49 49 50 /* Get telephone number from ldap or from post */ 50 51 $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); 51 $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile','homephone' ));52 $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile','homephone','datanascimento')); 52 53 $entrie = ldap_get_entries($ldap_conn, $result); 53 54 … … 56 57 $disabledMobile = false; 57 58 $disabledHomePhone = false; 59 $disableBirthday = false; 58 60 if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',1)) { 59 61 $disabledTelephoneNumber = '"disabled=true"'; … … 64 66 if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',4)) { 65 67 $disabledHomePhone = '"disabled=true"'; 68 } 69 if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',8)) { 70 $disableBirthday = '"disabled=true"'; 66 71 } 67 72 /* END ACL Check for Personal Data Fields.*/ … … 70 75 $GLOBALS['phpgw']->template->set_var('mobile',($_POST['mobile'] ? $_POST['mobile'] : $entrie[0]['mobile'][0]).$disabledMobile); 71 76 $GLOBALS['phpgw']->template->set_var('homephone',($_POST['homephone'] ? $_POST['homephone'] : $entrie[0]['homephone'][0]).$disabledHomePhone); 72 77 $GLOBALS['phpgw']->template->set_var('datanascimento',$_POST['datanascimento'] ? $_POST['datanascimento'] : $entrie[0]['datanascimento'][0] != '' ? $entrie[0]['datanascimento'][0] : ''); 78 73 79 74 80 ldap_close($ldap_conn); … … 82 88 { 83 89 if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] || $_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile'] 84 || $_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone'] )90 || $_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone'] || $_POST['datanascimento'] != $GLOBALS['phpgw_info']['user']['datanascimento']) 85 91 { 86 92 $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/'; … … 97 103 $errors[] = lang('Format of %1 telephone number is invalid.', lang("Home")); 98 104 } 105 106 if(!(checkdate(substr($_POST['datanascimento'],3,2),substr($_POST['datanascimento'],0,2),substr($_POST['datanascimento'],6,4)) == 1 107 || ($_POST['datanascimento'] == ''))) 108 { 109 $errors[] = lang('invalid date'); 110 } 99 111 if(!is_array($errors)) 100 112 { … … 160 172 unset($info['homephone']); 161 173 } 174 if (!$disableBirthday && ($_POST['datanascimento'] != $GLOBALS['phpgw_info']['user']['datanascimento'])) { 175 if (strlen($_POST['datanascimento']) == 0) { 176 $info['datanascimento'] = $GLOBALS['phpgw_info']['user']['datanascimento']; 177 $result = @ldap_mod_del($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 178 } 179 elseif(strlen($GLOBALS['phpgw_info']['user']['datanascimento']) == 0) { 180 $info['datanascimento'] = $_POST['datanascimento']; 181 $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 182 } 183 else { 184 $info['datanascimento'] = $_POST['datanascimento']; 185 $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 186 } 187 unset($info['datanascimento']); 188 } 162 189 ldap_close($ldap_conn); 163 190 }
Note: See TracChangeset
for help on using the changeset viewer.