<?php
/**
 * $Source: /home/cvs/nukescripts/kernel/langues.php,v $
 * $Revision: 1.1.0a $
 * $Author: cyril $
 * $Date: 2006/06/19 21:03:12 $
 *
 */
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or die ('Access denied langues MAXIMUS directly...');

if (!defined('FORUM_ADMIN')) {
	if ((isset($newlang)) AND !stristr($newlang,"\.")) {
		if (file_exists("language/lang-".$newlang.".php")) {
			@setcookie("lang",$newlang,time()+31536000);
		if (is_file("language/lang-".$newlang.".php")) {
			include("language/lang-".$newlang.".php");}
			$currentlang = $newlang;
		} else {
			@setcookie("lang",$language,time()+31536000);
		if (is_file("language/lang-".$language.".php")) {
			include_once("language/lang-".$language.".php");}
			$currentlang = $language;
		}
	} elseif (isset($lang)) {
	if (is_file("language/lang-".$lang.".php")) {
		include_once("language/lang-".$lang.".php");}
		$currentlang = $lang;
	} else {
		@setcookie("lang",$language,time()+31536000);
	if (is_file("language/lang-".$language.".php")) {
		include_once("language/lang-".$language.".php");}
		$currentlang = $language;
	}
}

function get_lang($module) {
	global $currentlang, $language;
	if (file_exists("modules/$module/language/lang-".$currentlang.".php")) {
		if ($module == "admin") {
	if (is_file("admin/language/lang-".$currentlang.".php")) {
			include_once("admin/language/lang-".$currentlang.".php");}
		} else {
	if (is_file("modules/$module/language/lang-".$currentlang.".php")) {
			include_once("modules/$module/language/lang-".$currentlang.".php");}
		}
	} else {
		if ($module != "Forums") {
			if ($module == "admin") {
if (is_file("admin/language/lang-".$currentlang.".php")) {
				include_once("admin/language/lang-".$currentlang.".php");}
			} else {
if (is_file("modules/$module/language/lang-".$language.".php")) {
				include_once("modules/$module/language/lang-".$language.".php");}
			}
		}
	}
}

function get_blang($block){
	global $currentlang, $language;
	if(@file_exists("language/$currentlang/blocks/".$block.".php")){
		include_once("language/$currentlang/blocks/".$block.".php");
	}
	else{
		if(@file_exists("language/$language/blocks/".$block.".php")){
			include_once("language/$language/blocks/".$block.".php");
		}
	}
}

function selectlanguage() {
    include_once(INCLUDE_PATH.'kernel/fly/selectlanguage.php');
}