mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-01 01:24:32 +03:00
Don't use MIBEW_WEB_ROOT in get_current_locale func
This commit is contained in:
parent
766be1f051
commit
a5d7c6ccd4
@ -104,11 +104,13 @@ class Application implements RouterAwareInterface, AuthenticationManagerAwareInt
|
|||||||
$context->fromRequest($request);
|
$context->fromRequest($request);
|
||||||
$this->getRouter()->setContext($context);
|
$this->getRouter()->setContext($context);
|
||||||
|
|
||||||
|
// Make cookie creation easy
|
||||||
|
$cookie_factory = CookieFactory::fromRequest($request);
|
||||||
|
|
||||||
$authentication_manager = $this->getAuthenticationManager();
|
$authentication_manager = $this->getAuthenticationManager();
|
||||||
// Actualize cookie factory in the authentication manager if it is
|
// Actualize cookie factory in the authentication manager if it is
|
||||||
// needed.
|
// needed.
|
||||||
if ($authentication_manager instanceof CookieFactoryAwareInterface) {
|
if ($authentication_manager instanceof CookieFactoryAwareInterface) {
|
||||||
$cookie_factory = CookieFactory::fromRequest($request);
|
|
||||||
$authentication_manager->setCookieFactory($cookie_factory);
|
$authentication_manager->setCookieFactory($cookie_factory);
|
||||||
}
|
}
|
||||||
$authentication_manager->setOperatorFromRequest($request);
|
$authentication_manager->setOperatorFromRequest($request);
|
||||||
@ -165,6 +167,16 @@ class Application implements RouterAwareInterface, AuthenticationManagerAwareInt
|
|||||||
// him in the next requests.
|
// him in the next requests.
|
||||||
$authentication_manager->attachOperatorToResponse($response);
|
$authentication_manager->attachOperatorToResponse($response);
|
||||||
|
|
||||||
|
// Cache user's locale in the cookie. The code below should be treated
|
||||||
|
// as a temporary workaround.
|
||||||
|
// TODO: Move the following lines to Locales Manager when object
|
||||||
|
// oriented approach for locales will be implemented.
|
||||||
|
$response->headers->setCookie($cookie_factory->createCookie(
|
||||||
|
LOCALE_COOKIE_NAME,
|
||||||
|
get_current_locale(),
|
||||||
|
time() + 60 * 60 * 24 * 1000
|
||||||
|
));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +217,6 @@ function get_current_locale()
|
|||||||
$locale = get_user_locale();
|
$locale = get_user_locale();
|
||||||
}
|
}
|
||||||
|
|
||||||
setcookie(LOCALE_COOKIE_NAME, $locale, time() + 60 * 60 * 24 * 1000, MIBEW_WEB_ROOT . "/");
|
|
||||||
|
|
||||||
$current_locale = $locale;
|
$current_locale = $locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user