<?php
ob_start();
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/loginroutines.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/loginroutines.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/loginroutines.inc');
}
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/db/mysqlroutines.inc');
}
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/translate.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/translate.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/translate.inc');
}
session_write_close();

if ( getSetting('portal','useRights',0) == 1 && IsUserLogin() ){
	if (isset($_REQUEST['user_idlanguageinterface'])){
		$cn = db_connect();
		$ln_arr = db_getLanguagesTranslate($cn, $_REQUEST['user_idlanguageinterface']);
		foreach ($ln_arr as $value){
			if (isset($_REQUEST['user_idlanguagecontent']) && ($_REQUEST['user_idlanguagecontent'] == $value['idlanguage'])) {
				echo '<option value="'.$value['idlanguage'].'" selected="selected">'.$value['lang_name'].'</option>';
			} else {
				echo '<option value="'.$value['idlanguage'].'">'.$value['lang_name'].'</option>';
			}
		}
	}
}
ob_end_flush();
?>