Пример #1
0
 public static function NewUser($username, $plainPassword, $authlevel, $primaryEmail, $secondaryEmail = "alternate_email", $colony = "Colony")
 {
     // Create the user and add him/her to the database
     $user = new User();
     $user->Username($username);
     $user->AuthorisationLevel($authlevel);
     $user->PrimaryEmail($primaryEmail);
     $user->SecondaryEmail($secondaryEmail);
     $currentTime = time();
     $user->RegistrationTime($currentTime);
     $user->LastOnline($currentTime);
     $user->IsBanned(FALSE);
     $user->BannedUntil(0);
     $userID = User::AddToDatabase($user, $plainPassword);
     $user->ID($userID);
     // Now that the user has been created, let's create a home colony for him or her
     $user->CurrentColony(Colony::CreateHomeBase($user, $colony));
     // Instantiate user's technologies and officers, and add them to database
     $user->Officers(OfficerGroup::Generateofficers($user));
     $user->Officers()->AddToDatabase();
     $user->Technologies(TechnologyGroup::GenerateTechs($user));
     $user->Technologies()->AddToDatabase();
     return $user;
 }