<?php	
// acciones que se reaizarán dependiendo del formulario usado
session_start();

////////////////////////////////////////
//									  //
// llamadas a funciones de DOCUMENTOS //
//									  //
////////////////////////////////////////

if ($_POST["edit_doc"]) // editar documento
{
	include ("doc.php");
	edit_doc($_POST['id'], $_POST['title'], $_POST['body']);
}
elseif ($_POST["publicate_doc"]) // identificarse
{
	include ("doc.php");
	publicate_doc($_POST['id']);
}
elseif ($_POST["active_doc"]) // identificarse
{
	include ("doc.php");
	activate_doc($_POST['id']);
}
elseif ($_POST["decline_doc"]) // identificarse
{
	include ("doc.php");
	decline_doc($_POST['id']);
}
elseif ($_POST["del_docs"]) // identificarse
{
	include ("doc.php");
	delete_docs();
}

///////////////////////////////////////
//									 //
// llamadas a funciones de SECCIONES //
//									 //	
///////////////////////////////////////

if ($_POST["mk_sec"]) // crea una seccion
{
	include ("sections.php");
	mk_sec($_POST['sec_name']);
}
elseif ($_POST["del_sec"])	// elimana las secciones seleccionadas
{
	include ("sections.php");
	del_sec($_POST['n_sec']);
}

///////////////////////////////////////////
//									     //
// llamadas a funciones de SUB-SECCIONES //
//									     //
///////////////////////////////////////////

if ($_POST["mk_sub_sec"]) // crear sub-sección
{
	include ("sections.php");
	mk_sub_sec($_POST['sub_sec_name'], $_POST['sec']);
}
elseif ($_POST["del_sub_sec"])	// elimana las sub-secciones seleccionadas
{
	include ("sections.php");
	del_sub_secs($_POST['n_sub_sec'], $_POST['id_sec']);
}

//////////////////////////////////////
//									//
// llamadas a funciones de USUARIOS	//
//									//
//////////////////////////////////////

if ($_POST["register"]) // registrarse
{
	include("login.php");
	register($_POST['name'],$_POST['pass1'],$_POST['pass2'],$_POST['email']);
}
elseif ($_POST["activate"]) // activar cuenta
{
	include("login.php");
	activate($_POST['user'],$_POST['code']);
}
elseif ($_POST["login"]) // identificarse
{
	include("login.php");
	login($_POST["name"],$_POST["pass"], $_POST["mode"]);
}

//////////////////////////////////
//								//
// llamadas a funciones de ROOT	//
//								//
//////////////////////////////////

if ($_POST["user_edit"]) // editar usuario
{
	include("root.php");
	
	for ($user = 0; $user <= $_POST['n_users']; $user++)
		if ($_POST[$user])
			edit_user($_POST[$user], $_POST['type']);

	echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=./?root=list_user'>";
}

?> 






