mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
minor
This commit is contained in:
parent
1aeb5618bb
commit
e50e729019
1 changed files with 22 additions and 29 deletions
|
@ -1,36 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Description of i18nActions
|
||||
*
|
||||
* @author Nacib Neme
|
||||
*/
|
||||
|
||||
class i18nActions extends Actions
|
||||
{
|
||||
public static function setCulture()
|
||||
public static function setCulture()
|
||||
{
|
||||
$culture = Request::getPostParam('culture');
|
||||
|
||||
// Validate
|
||||
if ($culture && !in_array($culture, i18n::getAllCultures()))
|
||||
{
|
||||
$culture = $_POST['culture'] ?? null;
|
||||
|
||||
// Validate
|
||||
if ($culture && !in_array($culture, i18n::getAllCultures()))
|
||||
{
|
||||
$culture = null;
|
||||
}
|
||||
|
||||
if ($culture)
|
||||
{
|
||||
Session::set(Session::KEY_USER_CULTURE, $culture);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Session::unsetKey(Session::KEY_USER_CULTURE);
|
||||
}
|
||||
|
||||
//if session changes update domain
|
||||
//english language = www
|
||||
|
||||
return Controller::redirect($_SERVER['HTTP_REFERER'] ?: '/');
|
||||
$culture = null;
|
||||
}
|
||||
|
||||
if ($culture)
|
||||
{
|
||||
Session::set(Session::KEY_USER_CULTURE, $culture);
|
||||
}
|
||||
else
|
||||
{
|
||||
Session::unsetKey(Session::KEY_USER_CULTURE);
|
||||
}
|
||||
|
||||
//if session changes update domain
|
||||
//english language = www
|
||||
|
||||
return Controller::redirect(Request::getHttpHeader('Referer', '/'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue