Changeset 3234 for branches/2.2
- Timestamp:
- 09/13/10 16:21:28 (14 years ago)
- Location:
- branches/2.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/phpgwapi/inc/class.accounts_ldap.inc.php
r1904 r3234 63 63 { 64 64 /* jakjr: using justthese with ldap_search */ 65 $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber" );65 $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile"); 66 66 $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese); 67 67 } … … 90 90 } 91 91 $this->data['telephonenumber'] = $allValues[0]['telephonenumber'][0]; 92 $this->data['mobile'] = $allValues[0]['mobile'][0]; 92 93 /* jakjr: this is not used for expressoLivre */ 93 94 /* -
branches/2.2/preferences/changepersonaldata.php
r1225 r3234 38 38 )); 39 39 40 $GLOBALS['phpgw']->template->set_var('lang_commercial_telephonenumber',lang(' Commercial Telephone number'));40 $GLOBALS['phpgw']->template->set_var('lang_commercial_telephonenumber',lang('%1 telephone number',lang('Commercial'))); 41 41 $GLOBALS['phpgw']->template->set_var('lang_ps_commercial_telephonenumber', 42 42 lang('Observation') . ': ' . lang('This telephone number will apear in searches for your name, and it will be visible for all ExpressoLivre Users') . '.'); 43 $GLOBALS['phpgw']->template->set_var('lang_mobile_telephonenumber',lang('%1 telephone number',lang('Mobile'))); 43 44 $GLOBALS['phpgw']->template->set_var('lang_change',lang('Change')); 44 45 $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); … … 47 48 /* Get telephone number from ldap or from post */ 48 49 $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); 49 $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber' ));50 $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile')); 50 51 $entrie = ldap_get_entries($ldap_conn, $result); 51 $GLOBALS['phpgw']->template->set_var('telephonenumber',$_POST['telephonenumber'] ? $_POST['telephonenumber'] : $entrie[0]['telephonenumber'][0]); 52 53 /* BEGIN ACL Check for Personal Data Fields.*/ 54 $disabledTelephoneNumber = false; 55 $disabledMobile = false; 56 57 if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',1)) { 58 $disabledTelephoneNumber = '"disabled=true"'; 59 } 60 if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',2)) { 61 $disabledMobile = '"disabled=true"'; 62 } 63 /* END ACL Check for Personal Data Fields.*/ 64 65 $GLOBALS['phpgw']->template->set_var('telephonenumber',($_POST['telephonenumber'] ? $_POST['telephonenumber'] : $entrie[0]['telephonenumber'][0]).$disabledTelephoneNumber); 66 $GLOBALS['phpgw']->template->set_var('mobile',($_POST['mobile'] ? $_POST['mobile'] : $entrie[0]['mobile'][0]).$disabledMobile); 67 52 68 ldap_close($ldap_conn); 53 69 … … 59 75 if ($_POST['change']) 60 76 { 61 if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] )77 if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] || $_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile']) 62 78 { 63 79 $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/'; 64 80 if ((strlen($_POST['telephonenumber']) != 0) && (!preg_match($pattern, $_POST['telephonenumber']))) 65 81 { 66 $errors[] = lang('Format of telephone number is invalid.');82 $errors[] = lang('Format of %1 telephone number is invalid.', lang("Commercial")); 67 83 } 68 else 84 if ((strlen($_POST['mobile']) != 0) && (!preg_match($pattern, $_POST['mobile']))) 85 { 86 $errors[] = lang('Format of %1 telephone number is invalid.', lang("Mobile")); 87 } 88 if(!is_array($errors)) 69 89 { 70 90 // Use LDAP Replication mode, if available … … 84 104 } 85 105 86 if ($GLOBALS['phpgw_info']['user']['telephonenumber']) 87 { 106 if(!$disabledTelephoneNumber && ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'])) { 88 107 if (strlen($_POST['telephonenumber']) == 0) { 89 108 $info['telephonenumber'] = $GLOBALS['phpgw_info']['user']['telephonenumber']; 90 109 $result = @ldap_mod_del($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 91 110 } 111 elseif(strlen($GLOBALS['phpgw_info']['user']['telephonenumber']) == 0) { 112 $info['telephonenumber'] = $_POST['telephonenumber']; 113 $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 114 } 92 115 else { 93 116 $info['telephonenumber'] = $_POST['telephonenumber']; 94 117 $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 95 118 } 119 unset($info['telephonenumber']); 96 120 } 97 else 98 { 99 $info['telephonenumber'] = $_POST['telephonenumber']; 100 $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 121 if (!$disabledMobile && ($_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile'])) { 122 if (strlen($_POST['mobile']) == 0) { 123 $info['mobile'] = $GLOBALS['phpgw_info']['user']['mobile']; 124 $result = @ldap_mod_del($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 125 } 126 elseif(strlen($GLOBALS['phpgw_info']['user']['mobile']) == 0) { 127 $info['mobile'] = $_POST['mobile']; 128 $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 129 } 130 else { 131 $info['mobile'] = $_POST['mobile']; 132 $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 133 } 101 134 } 135 ldap_close($ldap_conn); 102 136 } 103 137 -
branches/2.2/preferences/templates/default/changepersonaldata.tpl
r1132 r3234 18 18 </td> 19 19 </tr> 20 <tr><td colspan=2 height="20px"></td></tr> 21 <tr> 22 <td> 23 {lang_mobile_telephonenumber}: 24 </td> 25 <td> 26 <input type="input" autocomplete="off" name="mobile" size=12 value="{mobile}" maxlength="13" onkeyUp="FormatTelephoneNumber(event, this);"> (xx)xxxx-xxxx 27 </td> 28 </tr> 20 29 <tr> 21 30 <td colspan="3">
Note: See TracChangeset
for help on using the changeset viewer.