$selected_language = $config['langs'];
if (isset( $_POST['selected_language'] )) {
$_POST['selected_language'] = totranslit( $_POST['selected_language'], false, false );
if ($_POST['selected_language'] AND @is_dir ( ROOT_DIR . '/language/' . $_POST['selected_language'] )) {
$selected_language = $_POST['selected_language'];
set_cookie ( "selected_language", $selected_language, 365 );
}
} elseif (isset( $_COOKIE['selected_language'] )) {
$_COOKIE['selected_language'] = totranslit( $_COOKIE['selected_language'], false, false );
if ($_COOKIE['selected_language'] != "" AND @is_dir ( ROOT_DIR . '/language/' . $_COOKIE['selected_language'] )) {
$selected_language = $_COOKIE['selected_language'];
}
}