| @@ 102-119 (lines=18) @@ | ||
| 99 | $this->user = $view->user; |
|
| 100 | ||
| 101 | // If the user cannot be created/retrieved from Facebook info, redirect to login/register form |
|
| 102 | if (!$this->user) { |
|
| 103 | $redirect = urlencode( |
|
| 104 | $this->frontendUrl()->fromRoute( |
|
| 105 | 'mission/play', |
|
| 106 | array('id' => $this->game->getIdentifier()), |
|
| 107 | array('force_canonical' => true) |
|
| 108 | ) |
|
| 109 | ); |
|
| 110 | if (array_search('login', $this->game->getStepsArray())) { |
|
| 111 | return $this->redirect()->toUrl( |
|
| 112 | $this->frontendUrl()->fromRoute('mission/login') . '?redirect='.$redirect |
|
| 113 | ); |
|
| 114 | } else { |
|
| 115 | return $this->redirect()->toUrl( |
|
| 116 | $this->frontendUrl()->fromRoute('zfcuser/register') . '?redirect='.$redirect |
|
| 117 | ); |
|
| 118 | } |
|
| 119 | } |
|
| 120 | ||
| 121 | // The game is not played from Facebook : redirect to login/register form |
|
| 122 | ||
| @@ 123-141 (lines=19) @@ | ||
| 120 | ||
| 121 | // The game is not played from Facebook : redirect to login/register form |
|
| 122 | ||
| 123 | } elseif (!$this->game->getAnonymousAllowed()) { |
|
| 124 | $redirect = urlencode( |
|
| 125 | $this->frontendUrl()->fromRoute( |
|
| 126 | 'mission/play', |
|
| 127 | array('id' => $this->game->getIdentifier()), |
|
| 128 | array('force_canonical' => true) |
|
| 129 | ) |
|
| 130 | ); |
|
| 131 | ||
| 132 | if (array_search('login', $this->game->getStepsArray())) { |
|
| 133 | return $this->redirect()->toUrl( |
|
| 134 | $this->frontendUrl()->fromRoute('mission/login') . '?redirect='.$redirect |
|
| 135 | ); |
|
| 136 | } else { |
|
| 137 | return $this->redirect()->toUrl( |
|
| 138 | $this->frontendUrl()->fromRoute('zfcuser/register') . '?redirect='.$redirect |
|
| 139 | ); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ||
| 144 | $entry = $this->getGameService()->play($this->game, $this->user); |
|