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