function save_telephoneNumber($params) { $return = array(); if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['blockpersonaldata']) { $return['error'] = $this->functions->getLang("You can't modify your Commercial Telephone."); return $return; } $old_telephone = 0; $pattern = '/\\([0-9]{2,3}\\)[0-9]{4}-[0-9]{4}$/'; if (strlen($params['number']) != 0 && !preg_match($pattern, $params['number'])) { $return['error'] = $this->functions->getLang('The format of telephone number is invalid'); return $return; } if ($params['number'] != $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']) { $old_telephone = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']; $this->ldapRootConnect(false); if (strlen($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']) == 0) { $info['telephonenumber'] = $params['number']; $result = @ldap_mod_add($this->ds, $_SESSION['phpgw_info']['expressomail']['user']['account_dn'], $info); } else { $info['telephonenumber'] = $params['number']; $result = @ldap_mod_replace($this->ds, $_SESSION['phpgw_info']['expressomail']['user']['account_dn'], $info); } $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number'] = $info['telephonenumber']; // Log updated telephone number by user action include_once 'class.db_functions.inc.php'; $db_functions = new db_functions(); $db_functions->write_log('modified user telephone', "User changed its own telephone number in preferences {$old_telephone} => " . $info['telephonenumber']); unset($info['telephonenumber']); } return $return['ok'] = true; }