Exemplo n.º 1
0
 // ------------------------------
 case 'changeTeamProfile':
     // check inputs
     if (!isset($_GET['teamId']) or !isset($_GET['gameId']) or !isset($_GET['teamToken']) or !isset($_GET['profile'])) {
         rollbackAndDie();
     }
     // valid profile?
     if (!in_array($profile, Params::$profilName)) {
         rollbackAndDie();
     }
     // get the game
     if (!$game->get($gameId)) {
         rollbackAndDie();
     }
     // can only change our profile if the game haven't started yet
     if ($game->getRound() >= 1) {
         rollbackAndDie();
     }
     // team valid?
     if (!$team->checkIfLegit($teamId, $teamToken)) {
         rollbackAndDie();
     }
     // is the team really in this game? get it
     if (!$team->get($gameId, $teamId)) {
         rollbackAndDie();
     }
     // change the team profile
     if (!$team->changeProfile($gameId, $profile)) {
         rollbackAndDie();
     }
     break;