<?php
    $browserLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    if ($browserLang == 'id') {
        header("Location: https://1.abjteam.com/amp/index.html");
        exit;
    }
//echo 'Website is updated ';
//exit;
	require_once('config.php');
	
	$validLanguages = array('am', 'en', 'ru');
	$defaultLanguage = 'am';
	$lang['name'] = (isset($_GET['l']) and in_array($_GET['l'], $validLanguages)) ? $_GET['l'] : $defaultLanguage;
	
	ob_start();
		require(bDIR.'/engine/translations/'.$lang['name'].'.php');
	ob_end_clean();
	
	$validRoutes = array('p', 'cat', 'news_line', 'most_viewed', 'hitcounter', 'rate', 's', 'rss', 'static', 'poll', 'poll_true', 'poll_end', 'polls');

	$fb_location = array('am' => 'hy_AM', 'ru' => 'ru_RU');

	$route = 'index';

	foreach ($validRoutes as $value) {
		if (isset($_GET[$value])) {
			$route = $value;
		}
	}

	require bDIR."/engine/routes/{$route}.php";
?>