aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
blob: 9293c754f7a2ee78fdeaf1b77bae75d930d3f24a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/**
*/

require_once 'langs.inc.php';

if (isset($_GET['flang']))
{
    $lang = array_key_exists($_GET['flang'], $langs) ? $_GET['flang'] : 'en';
    if (isset($_GET['furl']))
    {
        $url = substr_replace($_GET['furl'], $lang, 1, 2);
    }
    else
        $url = '/' . $lang . '/';

    header(sprintf('Location: %s', $url));
    die;
}

require_once 'localeDetection.class.php';

$locale = new ChooseLocale(array_keys($langs));

$locale->setDefaultLocale('en');

header(sprintf('Location: /%s/', $locale->getCompatibleLocale()));
die;