<?php
/**
 * @package linea21.core
 * @subpackage admin
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */
ob_start();
session_start();
include_once("../lib/functions_auth.php");


if(!isset($_SESSION['sess_is_known'])) header("Location: login.php");


include_once("../lib/no_cache.php");
if(isset($_POST['rub']))	$rub=$_POST['rub'];
if(isset($_GET['rub']))	$rub=$_GET['rub'];

if(!isset($_GET['todo']) && !isset($_POST['todo'])) {
	$todo="list";
} else {
	if(isset($_POST['todo']))	$todo=$_POST['todo'];
	if(isset($_GET['todo']))	$todo=$_GET['todo'];
}
include_once("../config/define.php");
include_once("../config/server.php");
include_once("../lib/items.php");

if(defined('MOD_DEBUG') && MOD_DEBUG == true) {
  include_once('../class/system/class.bench.php');
  $bench = new bench();
  $bench->start_bench();
}


/**
* Section include 
* 
**/

$dir="../";
if(isset($rub)) {
	switch ($rub) {
		case 'level':
		$dir.="level";
		break;
		case 'scale':
		$dir.="scale";
		break;
		case 'theme':
		$dir.="theme";
		break;		
		case 'news':
		$dir.="news";
		break;
		case 'project':
		$dir.="project";
		break;	
		case 'newsletter':
		$dir.="newsletter";
		break;
		case 'publication':
		$dir.="publication";
		break;
		case 'sdi':
		$dir.="sdi";
		break;
		case 'dashboard':
		$dir.="dashboard";
		break;
		case 'user':
		$dir.="user";
		break;
		case 'workshop':
		$dir.="workshop";
		break;
		case 'workshoprep':
		$dir.="workshoprep";
		break;
		case 'yellowpages':
		$dir.="yellowpages";
		break;
		case 'resources':
		$dir.="resources";
		break;
		case 'contents':
		$dir.="contents";
		break;
		case 'system':
		$dir.="system";
		break;
		case 'tools':
		$dir.="tools";
		break;
		default:
		$dir.="home";
		$rub="home";
	}
} else {
		$dir.="home";
		$rub="home";
}
	
/**
* language include 
* 
**/
include_once('../lib/lang.php'); 
IncludeAdminLang($rub);




include_once("../lib/lib_common.php");
include_once("../class/system/class.".SQL.".php");

if(defined('MOD_DEBUG') && MOD_DEBUG == true) {
  $bench->add_flag('Pre-execute and includes');
}

$sql_entity=SQL;
$sql_object = new $sql_entity;
$sql_object -> DBInitialise();
$sql_object -> DBConnexion();
$rub_link="index.php?rub=".$rub;

include_once(SQL.'.inc.php');
$sql_inc_file=$dir."/".SQL.".inc.php";
if(file_exists($sql_inc_file)) include_once($sql_inc_file);

if(defined('MOD_DEBUG') && MOD_DEBUG == true) {
  $bench->add_flag('... loading SQL files');
}

include_once(THEME_ADMIN_PATH."index.php"); 




$sql_object -> DBClose();
ob_end_flush();
?>