Commit 753bf7d942e7cbc216110dd56f516b7f77bd0e0b
1 parent
5a40f74f
ua redirect
Showing
1 changed file
with
9 additions
and
1 deletions
Show diff stats
frontend/views/site/index.php
... | ... | @@ -20,8 +20,16 @@ $currentLang = \artbox\core\models\Language::getCurrent(); |
20 | 20 | $coordinates = []; |
21 | 21 | $coordinates[ 'lat' ] = empty($settings->lat) ? 0 : $settings->lat; |
22 | 22 | $coordinates[ 'lon' ] = empty($settings->lon) ? 0 : $settings->lon; |
23 | - | |
23 | +if ($currentLang->url==='ru') { | |
24 | + $cookies=Yii::$app->request->cookies; | |
25 | + if ($cookies->getValue('langCode', (isset($_COOKIE['langCode']))? $_COOKIE['langCode']: 'ua')==='ua') { | |
26 | + Yii::$app->response->redirect('/ua'); | |
27 | + } | |
28 | +} | |
24 | 29 | $js = <<< JS |
30 | +$('.header-lang a').click(function (){ | |
31 | + document.cookie = "langCode=" + $(this).text() + "; path=/;"; | |
32 | +}); | |
25 | 33 | window.lat = {$coordinates['lat']}; |
26 | 34 | window.lon = {$coordinates['lon']}; |
27 | 35 | JS; | ... | ... |