<?php

	if (!defined('IN_HUGLO')) {
		exit;
	}

	require_once('./includes/constants.php');
	require_once(ROOT_PATH . 'includes/db.php');
	require_once(ROOT_PATH . 'includes/template.php');
	require_once(ROOT_PATH . 'includes/template_compile.php');

	$l = isset($_GET['l']) ? ((array_search($_GET['l'], array('fr')) !== false) ? $_GET['l'] : 'fr') : 'fr';
	
	require_once(ROOT_PATH . 'language/' . $l . '.php');

	$db			= new db();
	$template	= new template();

	$db->sql_connect(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_BASE);
	$template->root 		= ROOT_PATH . 'styles/template';
	$template->cachepath	= ROOT_PATH . 'cache/tpl_' . str_replace('_', '-', 'huglo') . '_';

	$navbar = array();

	$sql = 'SELECT * FROM ' . CATEGORY_TABLE . ' WHERE category_parent_id = 0 ORDER BY category_sort ASC LIMIT 0, 7';
	$result = mysql_query($sql);
	while($row = mysql_fetch_assoc($result)) {
		$navbar[$row['category_id']] = array(
			'category_name_fr'	=>	$row['category_name_fr'],
			'category_name_en'	=>	$row['category_name_en'],
			'category_page'		=>	$row['category_page'],
			'category_bg_img'	=>	$row['category_bg_img'],
			'category_bg_color'	=>	$row['category_bg_color']
		);
	}
	mysql_free_result($result);
	
	foreach($navbar as $value) {
		$template->assign_block_vars('navbarrow', array(
			'U_LINK'	=>	BASE_PATH . '/' . $value['category_page'] . '.php',
			'T_NAME'	=>	$value['category_name_' . $l]
		));
	}

	$template->assign_vars(array(
		'BASE_PATH'			=>	BASE_PATH,
		'V_BG'				=>	false,
		'V_CV_PRINT'		=>	false,

		'L_TITLE_PAGE'		=>	$lang['TITLE_PAGE'],
		'L_FRENCH'			=>	$lang['FRENCH'],
		'L_ENGLISH'			=>	$lang['ENGLISH'],
		'L_FR'				=>	$lang['FR'],
		'L_EN'				=>	$lang['EN'],
		'L_HOME'			=>	$lang['HOME'],
		'L_SITEMAP'			=>	$lang['SITEMAP'],
		'L_IMPRINT'			=>	$lang['IMPRINT'],
		'L_COPYRIGHT'		=>	$lang['COPYRIGHT'],
		'L_PEOPLEANDTECH'	=>	$lang['PEOPLEANDTECH']
	));

?>
