本文整理汇总了PHP中BuckysUser::getUserStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP BuckysUser::getUserStatus方法的具体用法?PHP BuckysUser::getUserStatus怎么用?PHP BuckysUser::getUserStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuckysUser
的用法示例。
在下文中一共展示了BuckysUser::getUserStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNewAccount
/**
* Create New Account
*
* @param Array $data
* @return bool|int|null|string
*/
public static function createNewAccount($data)
{
global $db;
$data = array_map('trim', $data);
if ($data['firstName'] == '' || $data['lastName'] == '') {
buckys_add_message(MSG_USERNAME_EMPTY_ERROR, MSG_TYPE_ERROR);
return false;
}
//Check Email Address
if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $data['email'])) {
buckys_add_message(MSG_INVALID_EMAIL, MSG_TYPE_ERROR);
return false;
}
//Check Email Duplication
if (BuckysUser::checkEmailDuplication($data['email'])) {
//If this one is banned?
if (BuckysUser::getUserStatus($data['email']) == BuckysUser::STATUS_USER_DELETED) {
buckys_add_message(MSG_EMAIL_BANNED, MSG_TYPE_ERROR);
} else {
buckys_add_message(MSG_EMAIL_EXIST, MSG_TYPE_ERROR);
}
return false;
}
if (!$data['password'] || !$data['password2']) {
buckys_add_message(MSG_EMPTY_PASSWORD, MSG_TYPE_ERROR);
return false;
}
if ($data['password'] != $data['password2']) {
buckys_add_message(MSG_NOT_MATCH_PASSWORD, MSG_TYPE_ERROR);
return false;
}
if (!buckys_check_password_strength($data['password'])) {
buckys_add_message(MSG_PASSWORD_STRENGTH_ERROR, MSG_TYPE_ERROR);
return false;
}
//Create Token
$token = md5(mt_rand(0, 99999) . time() . $data['email'] . mt_rand(0, 99999));
$password = buckys_encrypt_password($data['password']);
//Create New Account
$newId = $db->insertFromArray(TABLE_USERS, ['firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'email_visibility' => -1, 'password' => $password, 'thumbnail' => '', 'user_type' => 'Registered', 'user_acl_id' => 2, 'ip_addr' => $_SERVER['REMOTE_ADDR'], 'created_date' => date('Y-m-d H:i:s'), 'token' => $token]);
if (!$newId) {
buckys_add_message($db->getLastError(), MSG_TYPE_ERROR);
return false;
}
//Create New Record on the users_stats table
$db->insertFromArray(TABLE_USERS_STATS, ['userID' => $newId, 'pageFollowers' => 0, 'likes' => 0, 'comments' => 0, 'voteUps' => 0, 'replies' => 0, 'reputation' => 0]);
//Make new user to follow all categories
BuckysForumFollower::followBasicForums($newId);
$url_protocol = "http://";
if (SITE_USING_SSL == true) {
$url_protocol = "https://";
}
//Send an email to new user with a validation link
$link = $url_protocol . $_SERVER['HTTP_HOST'] . "/register.php?action=verify&email=" . $data['email'] . "&token=" . $token;
$title = "Please verify your account.";
$body = "Dear " . $data['firstName'] . " " . $data['lastName'] . "\n\n" . "Thanks for your registration. \n" . "To complete your registration, please verify your email address by clicking the below link:. \n" . $link . "\n\n" . TNB_DOMAIN;
buckys_sendmail($data['email'], $data['firstName'] . " " . $data['lastName'], $title, $body);
return $newId;
}