<?php
/*
  ===============================================================

  inGenio X
  http://ingenio.area421.com

  Created by 
  Julian Moreno Hidalgo (Software developer)
  Jesus Moreno Hidalgo (Communication's tree)

  inGenio X is a free software licensed under CC-GNU GPL

  ===============================================================
*/
	if (!defined("IGNX")) { die("Attempt..."); }

	// limite tiempo script
	@set_time_limit(0);
	
	// funciones
	include("inc.funciones.php");
	
	// conectar
	$ingenio_conn = array();
	include("../igns/ingenio_conn.php");
	myconnect($ingenio_conn[0],$ingenio_conn[1],$ingenio_conn[2],$ingenio_conn[3]);

	// configurar
	$qig = myquery("SELECT * FROM ".INGENIO,"[inc.global=conf]");
	while ($row_qig = myfetch($qig))
	{
		define("CONFIG_".$row_qig["igID"], $row_qig["topic"]);
	}
	include("../ints/core/core.modr.php");
	
	// numero idiomas
	if ( CONFIG_13 == "" || CONFIG_13 > 5 || !is_numeric(CONFIG_13))
	{
		$num_idiomas =  0 ;
		define ("NUM_IDIOMAS", $num_idiomas);
	} else {
		$num_idiomas =  CONFIG_13 ;		
		define ("NUM_IDIOMAS", $num_idiomas);
	}
	
	// idioma admin //
	If (isset($_GET["len"]))
	{		
		$len = $_GET["len"];
		
		// time()+3600*24*15 -> el ultimo digito (...*15)
		//						indica los dias de gestion
		setcookie("GX_lad", $len, time()+3600*24*365, "/");
		
		$qid = myquery("SELECT * FROM ".IDIOMA_ADMIN,"[inc.global=lens1]");
		while ($row_qid = myfetch($qid))
		{
			if ($len == 0)
			{
				define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre"]);
			} else {
				define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre_".$len]);
			}
		}

	} else {

		// aumentar la gestion de idioma
		if (isset($_COOKIE["GX_lad"]))
		{
			$GX_lad = $_COOKIE["GX_lad"];
			// time()+3600*24*15 -> el ultimo digito (...*15)
			//						indica los dias de gestion
			setcookie("GX_lad", $GX_lad, time()+3600*24*365, "/");

			$qid = myquery("SELECT * FROM ".IDIOMA_ADMIN,"[inc.global=lens2]");
			while ($row_qid = myfetch($qid))
			{
				if ($GX_lad == 0)
				{
					define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre"]);
				} else {
					define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre_".$GX_lad]);
				}
			}
	
		} else {

			if ( CONFIG_82 == "" || CONFIG_82 > 5 || !is_numeric(CONFIG_82))
			{
				$idioma_admin = 0 ;
			} else {
				$idioma_admin = CONFIG_82 ;
			}

			$qid = myquery("SELECT * FROM ".IDIOMA_ADMIN,"[inc.global=lens3]");
			while ($row_qid = myfetch($qid))
			{
				if ($idioma_admin == 0)
				{
					define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre"]);
				} else {
					define("LEN_ADMIN_".$row_qid["lenID"], $row_qid["topic_pre_".$idioma_admin]);
				}
			}
		
		} // del if aumentar...
	
	}
	// fin idioma admin //

	// inicio
	session_start();

	include("inc.login.php");

?>