<?php
/*
	DevSaver Web Framework
	Copyright (c) 2002-2018 DevSaver. 
	All rights reserved.
		web:  www.devsaver.com
		mail: support@devsaver.com
*/

if (!defined("STPBase")) {
	die("This file can't be accessed directly!");
}

// dependencies

if (CONSTANT("STP_ENABLE_DEMO") == "1") {

	if (!is_array($_SESS["minibase"]["raw"])) {
		$_SESS["minibase"] = array(
			"demo_mode" => 1,
			"user"	=> 1,
			"raw"	=> array(
				"user_login"		=> "demo",
				"user_first_name"	=> "Demo",
				"acl"				=> "superadmin"
			)
		);	

		urlredirect("index.php");
	}
} else {
	if ($_SESS["minibase"]["demo_mode"]) {
		unset($_SESS["minibase"]);
		urlredirect("index.php");
	}	
}


if (!is_array($_SESS["minibase"])) {
	if ($_COOKIE["autologin"] == "true") {

		global $site;


		require_once _MODPATH . "auth/backend.php";

		$auth = new CAuthBackend();
		$auth->forceInit();
		$auth->AutoLogin();
	}
}
