<?php

include_once './config/settings.php';
include_once './controllers/DataBaseController.php';
include_once './lang/languages.php';
include_once './controllers/HeadController.php';
include_once './controllers/TopBarController.php';
include_once "./classes/User.php";


class Core{

    var $head;
    var $topbar;
    var $controller;
    var $langs;
    var $user;

    /**
     * @param $controller
     */
    public function Core(){

        session_start();

        //Languages
        $this->langs = new Languages();

        //Head
		$this->head = new HeadController();

		printf('<BODY>');

        $this->user = new User();

        //Top-bar
        $this->topbar = new TopBarController();

	}

    protected function isPrivateZone(){

        if (isset($_SESSION["token"])) {
            if (!$this->user->validateToken())
                header('Location: login.php');
        }else
            header('Location: login.php');
    }
	
    protected function setController($controller){
        $this->controller = $controller;
    }
    protected function getController(){
        return $this->controller;
    }


}

?>