本文整理汇总了PHP中UserStatus::normalize_name方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::normalize_name方法的具体用法?PHP UserStatus::normalize_name怎么用?PHP UserStatus::normalize_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserStatus
的用法示例。
在下文中一共展示了UserStatus::normalize_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_user
function save_user($cj, $user_status, $Acct, $allow_modification)
{
global $Conf, $Me, $Opt, $OK, $newProfile;
if ($newProfile) {
$Acct = null;
}
// check for missing fields
UserStatus::normalize_name($cj);
if ($newProfile && !isset($cj->email)) {
$user_status->set_error("email", "Email address required.");
return false;
}
// check email
if ($newProfile || $cj->email != $Acct->email) {
if ($new_acct = Contact::find_by_email($cj->email)) {
if ($allow_modification) {
$cj->id = $new_acct->contactId;
} else {
$msg = "Email address “" . htmlspecialchars($cj->email) . "” is already in use.";
if ($Me->privChair) {
$msg = str_replace("an account", "<a href=\"" . hoturl("profile", "u=" . urlencode($cj->email)) . "\">an account</a>", $msg);
}
if (!$newProfile) {
$msg .= " You may want to <a href=\"" . hoturl("mergeaccounts") . "\">merge these accounts</a>.";
}
return $user_status->set_error("email", $msg);
}
} else {
if (Contact::external_login()) {
if ($cj->email === "") {
return $user_status->set_error("email", "Not a valid username.");
}
} else {
if ($cj->email === "") {
return $user_status->set_error("email", "You must supply an email address.");
} else {
if (!validate_email($cj->email)) {
return $user_status->set_error("email", "“" . htmlspecialchars($cj->email) . "” is not a valid email address.");
}
}
}
}
if (!$newProfile && !$Me->privChair) {
$old_preferredEmail = $Acct->preferredEmail;
$Acct->preferredEmail = $cj->email;
$capmgr = $Conf->capability_manager();
$rest = array("capability" => $capmgr->create(CAPTYPE_CHANGEEMAIL, array("user" => $Acct, "timeExpires" => time() + 259200, "data" => json_encode(array("uemail" => $cj->email)))));
$mailer = new HotCRPMailer($Acct, null, $rest);
$prep = $mailer->make_preparation("@changeemail", $rest);
if ($prep->sendable) {
Mailer::send_preparation($prep);
$Conf->warnMsg("Mail has been sent to " . htmlspecialchars($cj->email) . ". Use the link it contains to confirm your email change request.");
} else {
Conf::msg_error("Mail cannot be sent to " . htmlspecialchars($cj->email) . " at this time. Your email address was unchanged.");
}
// Save changes *except* for new email, by restoring old email.
$cj->email = $Acct->email;
$Acct->preferredEmail = $old_preferredEmail;
}
}
// save account
return $user_status->save($cj, $Acct, $Me);
}