Ejemplo n.º 1
0
 public static function Create($member_username, $password, $member_longname, $user_URLName, $member_email, $member_emailcode = null)
 {
     $CurrentTenant = Tenant::GetCurrent();
     if ($CurrentTenant == null) {
         return null;
     }
     $passwordSalt = \UUID::Generate();
     $passwordHash = hash("sha512", $passwordSalt . $password);
     global $MySQL;
     $query = "INSERT INTO " . System::GetConfigurationValue("Database.TablePrefix") . "Users (user_TenantID, user_LoginID, user_PasswordHash, user_PasswordSalt, user_DisplayName, user_URLName, user_EmailAddress, user_EmailConfirmationCode, user_RegistrationTimestamp, user_RegistrationIPAddress) VALUES (" . $CurrentTenant->ID . ", " . "'" . $MySQL->real_escape_string($member_username) . "', " . "'" . $MySQL->real_escape_string($passwordHash) . "', " . "'" . $MySQL->real_escape_string($passwordSalt) . "', " . "'" . $MySQL->real_escape_string($member_longname) . "', " . "'" . $MySQL->real_escape_string($user_URLName) . "', " . "'" . $MySQL->real_escape_string($member_email) . "', " . ($member_emailcode == null ? "NULL" : "'" . $MySQL->real_escape_string($member_emailcode) . "'") . ", " . "NOW()," . "'" . $_SERVER["REMOTE_ADDR"] . "'" . ")";
     $result = $MySQL->query($query);
     if ($MySQL->errno == 0) {
         $id = $MySQL->insert_id;
         $user = User::GetByID($id, true);
         MarketResourceTransaction::Create(MarketResourceTransaction::GetInitialResources(), $user, null, "InitialResourceAllotmentForUser:" . $user->ID, null);
         return $user;
     }
     return null;
 }
Ejemplo n.º 2
0
        $UserRegistered = UserRegistrationStatus::Unregistered;
    }
}
if ($UserRegistered == UserRegistrationStatus::Unregistered || $UserRegistered == UserRegistrationStatus::UserNameTaken || $UserRegistered == UserRegistrationStatus::DisplayNameTaken || $UserRegistered == UserRegistrationStatus::PasswordMismatch) {
    $page = new RegistrationWebPage();
    $page->Render();
} else {
    if ($UserRegistered == UserRegistrationStatus::AwaitingVerification) {
        if (System::$Configuration["Account.Registration.EmailVerification.Enabled"]) {
            $page = new MessagePage("Register");
            $page->Message = "Thank you for your interest in becoming a member of the " . System::GetConfigurationValue("Application.Name") . " community. Before your request can be processed, " . "you must verify your e-mail address. A verification e-mail has been sent to <strong>" . $_POST["em"] . "</strong>. Please click on the link in the " . "verification e-mail to complete your registration.";
            $page->Render();
        } else {
            $page = new MessagePage("Register");
            $message = "<p>Thank you for your interest in becoming a member of the " . System::GetConfigurationValue("Application.Name") . " community. Your request has been processed, and you may now log in to the site.</p>";
            $resources = MarketResourceTransaction::GetInitialResources();
            if (count($resources) > 0) {
                $message .= "<p>You have received the following as a thank-you gift for joining our community.</p>";
                $message .= "<div style=\"text-align: center;\">";
                foreach ($resources as $resource) {
                    $title = $resource->Amount == 1 ? $resource->ResourceType->TitleSingular : $resource->ResourceType->TitlePlural;
                    $message .= "<div class=\"Resource\">";
                    $message .= "<div class=\"Icon\"><img alt=\"" . $title . "\" src=\"" . System::ExpandRelativePath("~/images/resources/24x24/" . $resource->ResourceType->ID . ".png") . "\" title=\"" . $title . "\" /></div>";
                    $message .= "<div class=\"Value\">" . $resource->Amount . "</div>";
                    $message .= "</div>";
                }
                $message .= "</div>";
            }
            $page->Message = $message;
            $page->ReturnButtonText = "Log In to " . System::GetConfigurationValue("Application.Name");
            $page->ReturnButtonURL = System::ExpandRelativePath(System::GetConfigurationValue("Account.LoginPath"));