<?php
/*
+--------------------------------------------------------------------------
|   CubeCart 4
|   ========================================
|	CubeCart is a registered trade mark of Devellion Limited
|   Copyright Devellion Limited 2006. All rights reserved.
|   Devellion Limited,
|   5 Bridge Street,
|   Bishops Stortford,
|   HERTFORDSHIRE.
|   CM23 2JU
|   UNITED KINGDOM
|   http://www.devellion.com
|	UK Private Limited Company No. 5323904
|   ========================================
|   Web: http://www.cubecart.com
|   Email: info (at) cubecart (dot) com
|	License Type: CubeCart is NOT Open Source Software and Limitations Apply 
|   Licence Info: http://www.cubecart.com/v4-software-license
+--------------------------------------------------------------------------
|	language.inc.php
|   ========================================
|	Language Jump Box	
+--------------------------------------------------------------------------
*/

if (!defined('CC_INI_SET')) die('Access Denied');

## Include lang file
$lang			= getLang('includes'.CC_DS.'boxes'.CC_DS.'language.inc.php');
$box_content	= new XTemplate('boxes'.CC_DS.'language.tpl');

$box_content->assign('LANG_LANGUAGE_TITLE', $lang['language']['language']);

$path = 'language';
if (is_dir($path)) {
	$returnPage = urlencode(currentPage());
	foreach (glob($path.CC_DS.'*', GLOB_MARK) as $folder) {
		if (is_dir($folder) && preg_match('#[a-z]{2}(\_[A-Z]{2})?#i', $folder) && file_exists($folder.'config.php')) {
		#	ob_start();
			require $folder.'config.php';
			$box_content->assign('LANG_SELECTED', (LANG_FOLDER == str_replace(array('language', CC_DS), '', $folder)) ? 'selected="selected"' : '');
		
			$box_content->assign('LANG_NAME', $langName); //mb_convert_encoding($langName, 'UTF-8', mb_detect_encoding($langName)));
			$box_content->assign('LANG_VAL', str_replace(array('language', CC_DS), '', $folder));
			$box_content->assign('VAL_CURRENT_PAGE', $returnPage);
			$box_content->parse('language.option');
		#	ob_end_clean();
		}
	}
	## patch for bug #1031
	if (file_exists('language'.CC_DS.LANG_FOLDER.CC_DS.'config.php')) {
		include 'language'.CC_DS.LANG_FOLDER.CC_DS.'config.php';
	}
}

$box_content->assign('ICON_FLAG', LANG_FOLDER."/flag.gif");
$box_content->parse('language');
$box_content = $box_content->text('language');
?>