getConf()->get(['registry', 'general', 'allow-indexation']) === true) { $buffer = "User-Agent: *\n" . "Allow: /\n"; } else { $buffer = "User-Agent: *\n" . "Disallow: /\n"; } return new Response($buffer, 200, ['Content-Type' => 'text/plain']); } public function getRoot() { return $this->app->redirectPath('homepage'); } public function setLocale($locale) { $response = $this->app->redirectPath('root'); $cookiePath = ini_get('session.cookie_path'); $cookieDomain = ini_get('session.cookie_domain'); $cookieHttpOnly = ini_get('session.cookie_httponly'); $cookieSecure = ini_get('session.cookie_secure'); $response->headers->setCookie(new Cookie( 'locale', $locale, 0, $cookiePath, empty($cookieDomain)? null : $cookieDomain, $cookieSecure ? true: false, $cookieHttpOnly ? true : false )); $authenticatedUser = $this->getAuthenticatedUser(); // if connected, update user locale if ($authenticatedUser !== null) { try { $authenticatedUser->setLocale($locale); $this->getEntityManager()->flush(); } catch (\Exception $e) { // invalid locale } } return $response; } public function getAvailableLanguages() { return $this->app->json($this->app['locales.available']); } }