private function prepare_realname($p_user_info, $p_username) { switch ($this->_mail_preferred_realname) { case 'email_address': $t_realname = $p_user_info['email']; break; case 'email_no_domain': if (preg_match(email_regex_simple(), $p_user_info['email'], $t_check)) { $t_local = $t_check[1]; $t_domain = $t_check[2]; $t_realname = $t_local; } break; case 'from_ldap': $t_realname = ldap_realname_from_username($p_username); break; case 'full_from': $t_realname = str_replace(array('<', '>'), array('(', ')'), $p_user_info['From']); break; case 'name': default: $t_realname = $p_user_info['name']; } $t_realname = string_normalize($t_realname); if (utf8_strlen($t_realname) > DB_FIELD_SIZE_REALNAME) { $t_realname = utf8_substr($t_realname, 0, DB_FIELD_SIZE_REALNAME); } if (user_is_realname_valid($t_realname) && user_is_realname_unique($p_username, $t_realname)) { return $t_realname; } return FALSE; }
$t_redirect = 'account_page.php'; $t_email_updated = false; $t_password_updated = false; $t_realname_updated = false; /** @todo Listing what fields were updated is not standard behaviour of MantisBT - it also complicates the code. */ if (OFF == config_get('use_ldap_email')) { $f_email = email_append_domain($f_email); email_ensure_valid($f_email); email_ensure_not_disposable($f_email); if ($f_email != user_get_email($t_user_id)) { user_set_email($t_user_id, $f_email); $t_email_updated = true; } } # strip extra spaces from real name $t_realname = string_normalize($f_realname); if ($t_realname != user_get_field($t_user_id, 'realname')) { # checks for problems with realnames $t_username = user_get_field($t_user_id, 'username'); user_ensure_realname_unique($t_username, $t_realname); user_set_realname($t_user_id, $t_realname); $t_realname_updated = true; } # Update password if the two match and are not empty if (!is_blank($f_password)) { if ($f_password != $f_password_confirm) { trigger_error(ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR); } else { if (!auth_does_password_match($t_user_id, $f_password)) { user_set_password($t_user_id, $f_password); $t_password_updated = true;
function url_title($str, $separator = 'dash') { if ($separator == 'dash') { $search = '_'; $replace = '-'; } else { $search = '-'; $replace = '_'; } $str = string_normalize($str); $trans = array($search => $replace, "\\s+" => $replace, "[^\\.a-z0-9" . $replace . "]" => '', $replace . "+" => $replace, $replace . "\$" => '', "^" . $replace => ''); $str = strip_tags(strtolower($str)); foreach ($trans as $key => $val) { $str = preg_replace("#" . $key . "#", $val, $str); } return trim(stripslashes($str)); }