当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::newPlayer方法代码示例

本文整理汇总了PHP中Player::newPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::newPlayer方法的具体用法?PHP Player::newPlayer怎么用?PHP Player::newPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::newPlayer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNewUser

 protected function getNewUser($username = "Sam", $role = Player::PLAYER)
 {
     // Try to find a valid bzid
     $bzid = 300;
     while (Player::getFromBZID($bzid)->isValid()) {
         ++$bzid;
         if ($bzid > 15000) {
             throw new Exception("bzid too big");
         }
     }
     return Player::newPlayer($bzid, $username, null, "test", $role);
 }
开发者ID:allejo,项目名称:bzion,代码行数:12,代码来源:FeatureContext.php

示例2: loginAction

 public function loginAction(Request $request, Player $me)
 {
     if ($me->isValid()) {
         throw new ForbiddenException("You are already logged in!");
     }
     $query = $request->query;
     $session = $request->getSession();
     $token = $query->get("token");
     $username = $query->get("username");
     if (!$token || !$username) {
         throw new BadRequestException();
     }
     // Don't check whether IPs match if we're on a development environment
     $checkIP = !$this->isDebug();
     $info = validate_token($token, $username, array(), $checkIP);
     if (!isset($info)) {
         throw new ForbiddenException("There was an error processing your login. Please go back and try again.");
     }
     $session->set("username", $info['username']);
     $session->set("groups", $info['groups']);
     $redirectToProfile = false;
     if (!Player::playerBZIDExists($info['bzid'])) {
         // If they're new, redirect to their profile page so they can add some info
         $player = Player::newPlayer($info['bzid'], $info['username']);
         $redirectToProfile = true;
     } else {
         $player = Player::getFromBZID($info['bzid']);
         if ($player->isDeleted()) {
             $player->setStatus('active');
         }
     }
     $session->set("playerId", $player->getId());
     $player->updateLastLogin();
     $player->setUsername($info['username']);
     Visit::enterVisit($player->getId(), $request->getClientIp(), gethostbyaddr($request->getClientIp()), $request->server->get('HTTP_USER_AGENT'), $request->server->get('HTTP_REFERER'));
     $this->configPromoteAdmin($player);
     if ($redirectToProfile) {
         $profile = Service::getGenerator()->generate('profile_show');
         return new RedirectResponse($profile);
     } else {
         return $this->goBack();
     }
 }
开发者ID:blast007,项目名称:bzion,代码行数:43,代码来源:LoginController.php

示例3: die

    die("Please clear your current data in the database or you'll end up with duplicate entries.\n");
}
echo "Adding players...";
$alezakos = Player::newPlayer(49434, "alezakos", null, "active", Player::DEVELOPER, "", "Sample description", 84);
$allejo = Player::newPlayer(31098, "allejo", null, "active", Player::DEVELOPER, "", "I'm the one who breaks the build", 227);
$ashvala = Player::newPlayer(34353, "ashvala", null, "active", Player::DEVELOPER, "", "", 100);
$autoreport = Player::newPlayer(55976, "AutoReport", null, "test");
$blast = Player::newPlayer(180, "blast", null, "active", Player::S_ADMIN);
$kierra = Player::newPlayer(2229, "kierra", null, "active", Player::ADMIN, "", "", 174);
$mdskpr = Player::newPlayer(8312, "mdskpr");
$snake = Player::newPlayer(54497, "Snake12534");
$tw1sted = Player::newPlayer(9736, "tw1sted", null, "active", Player::DEVELOPER);
$brad = Player::newPlayer(3030, "brad", null, "active", Player::S_ADMIN, "", "I keep nagging about when this project will be done");
$constitution = Player::newPlayer(9972, "Constitution", null, "active", Player::S_ADMIN);
$themap = Player::newPlayer(57422, "the map", null, "active", Player::COP);
$oldSnake = Player::newPlayer(54498, "Snake12534");
$oldSnake->setOutdated(true);
$allPlayers = array($alezakos, $allejo, $ashvala, $autoreport, $blast, $kierra, $mdskpr, $snake, $tw1sted, $brad, $constitution, $themap);
echo " done!";
echo "\nSending notifications...";
foreach (Player::getPlayers() as $player) {
    $event = new WelcomeEvent('Welcome to ' . Service::getParameter('bzion.site.name') . '!', $player);
    Notification::newNotification($player->getId(), 'welcome', $event);
}
echo " done!";
echo "\nAdding deleted objects...";
Team::createTeam("Amphibians", $snake->getId(), "", "")->delete();
$snake->refresh();
Team::createTeam("Serpents", $snake->getId(), "", "")->delete();
$snake->refresh();
Page::addPage("Test", "<p>This is a deleted page</p>", $tw1sted->getId())->delete();
开发者ID:allejo,项目名称:bzion,代码行数:31,代码来源:sampleData.php

示例4: getNewPlayer

 /**
  * Create a new sample player
  *
  * @return Player
  */
 protected function getNewPlayer()
 {
     ++$this->lastBzid;
     $player = Player::newPlayer($this->lastBzid, "Sample player" . $this->lastBzid - 1);
     $this->playersCreated[] = $player->getId();
     return $player;
 }
开发者ID:blast007,项目名称:bzion,代码行数:12,代码来源:TestCase.php

示例5: die

$kernel->boot();
$testPlayer = Player::getFromBZID(3030);
if ($testPlayer->isValid()) {
    die("Please clear your current data in the database or you'll end up with duplicate entries.\n");
}
echo "Adding players...";
$alezakos = Player::newPlayer(49434, "alezakos", null, "active", Player::DEVELOPER, "", "Sample description", 84);
$allejo = Player::newPlayer(31098, "allejo", null, "active", Player::DEVELOPER, "", "I'm the one who breaks the build", 227);
$ashvala = Player::newPlayer(34353, "ashvala", null, "active", Player::DEVELOPER, "", "", 100);
$autoreport = Player::newPlayer(55976, "AutoReport", null, "test");
$blast = Player::newPlayer(180, "blast", null, "active", Player::S_ADMIN);
$kierra = Player::newPlayer(2229, "kierra", null, "active", Player::ADMIN, "", "", 174);
$mdskpr = Player::newPlayer(8312, "mdskpr");
$snake = Player::newPlayer(54497, "Snake12534");
$tw1sted = Player::newPlayer(9736, "tw1sted", null, "active", Player::DEVELOPER);
$brad = Player::newPlayer(3030, "brad", null, "active", Player::S_ADMIN, "", "I keep nagging about when this project will be done");
echo " done!";
echo "\nSending notifications...";
foreach (Player::getPlayers() as $player) {
    $event = new WelcomeEvent('Welcome to ' . Service::getParameter('bzion.site.name') . '!', $player);
    Notification::newNotification($player->getId(), 'welcome', $event);
}
echo " done!";
echo "\nAdding deleted objects...";
Team::createTeam("Amphibians", $snake->getId(), "", "")->delete();
$snake->refresh();
Team::createTeam("Serpents", $snake->getId(), "", "")->delete();
$snake->refresh();
Page::addPage("Test", "<p>This is a deleted page</p>", $tw1sted->getId())->delete();
echo " done!";
echo "\nAdding teams...";
开发者ID:kleitz,项目名称:bzion,代码行数:31,代码来源:sampleData.php


注:本文中的Player::newPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。