<?php
include_once(SABLE_CLASS_PATH.'sable_debug.php');//SableDebug::
require_once(SABLE_CLASS_PATH.'sable_db.php');
require_once(SABLE_CLASS_PATH.'sable_db_functions.php');//SableDBFunctions::
require_once(SABLE_CLASS_PATH.'sable_general_functions.php');//SableGeneralFunctions::
require_once(SABLE_CLASS_PATH.'sable_system.php'); //SableSystem::
require_once(SABLE_CLASS_PATH.'sable_validation_functions.php'); //SableValidationFunctions::

class SableCore
{
	//Declare all the necessary public variables to be used by the session.
	public $sableSystem, $sableGeneralFunctions, $sableDBFunctions, $sableDebug;
	public $prefix, $coyTitle, $sableDB;
	
	function __construct()
	{
		$this->sableDB = new SableDB();
		$this->SableSystem = new SableSystem();
		$this->SableSystem->buildArgvArgc();
		
		$this->SableGeneralFunctions = new SableGeneralFunctions();
		$this->coyTitle = $this->SableGeneralFunctions->setCoyTitle();
		
		$this->SableDBFunctions = new SableDBFunctions();
		
		if ($this->SableSystem->currentDir() !== 'lib')
		{
			if (!session_id()) 
			{
				session_start();
				unset($_SESSION);
				$this->SableDBFunctions->updateSessionVars();
			}
			$this->prefix = $this->SableSystem->setSessionPrefix(); //sets both $prefix and $_SESSION['prefix'] to the necessary prefix value.
			$this->SableSystem->verifySession();
		}
	}
	
	function __destruct(){}
	
	
}