<?php
/*
 * This file is part of a larger software package. Please read the License file 
 * in the root of this installation for terms of usage and distribution.
 * 
 * @author The Web Pro Miami, Inc. <info@thewebpro.com>
 * @copyright The Web Pro Miami, Inc. <info@thewebpro.com>, http://www.thewebpro.com/
 * 
 * CORE: manage/inc/lang_util.php - version 1.0
*/

// Get language settings
$nSettingsARRAY = array();
$nSQL = "SELECT nValue FROM nSettings WHERE nSetting='defLanguage'";
mysql_select_db($DBName); $Result = mysql_query($nSQL,$Link);
while($Row = mysql_fetch_array($Result)){
	$nDefaultLang = $Row["nValue"];
}
function nConvertIntChars($nText){
	if(!$nText){ return; }
	// lowercase
	$nText = str_replace("ú","&uacute;",$nText);
	$nText = str_replace("í","&iacute;",$nText);
	$nText = str_replace("ó","&oacute;",$nText);
	$nText = str_replace("é","&eacute;",$nText);
	$nText = str_replace("á","&aacute;",$nText);
	$nText = str_replace("ñ","&ntilde;",$nText);
	// uppercase
	$nText = str_replace("Ú","&Uacute;",$nText);
	$nText = str_replace("Í","&Iacute;",$nText);
	$nText = str_replace("Ó","&Oacute;",$nText);
	$nText = str_replace("É","&Eacute;",$nText);
	$nText = str_replace("Á","&Aacute;",$nText);
	$nText = str_replace("Ñ","&Ntilde;",$nText);
	return $nText;
}
function nGetTranslation($nLangCode,$nItemID,$nField,$nType){
	global $DBName,$Link;
	if(!$nLangCode || !$nItemID || !$nField || !$nType){ return; }
	$Query = "SELECT $nField AS nField FROM nTranslate WHERE nLang='$nLangCode' AND nItemID='$nItemID' AND nType='$nType'";
	mysql_select_db($DBName); $Result = mysql_query($Query,$Link);
	if ($Row = mysql_fetch_array($Result)) {
		$nTranslation = $Row["nField"];
	}
	return $nTranslation;
}
?>
