Вот собственно код ядра
<?php
/**
* @author Folour aka XeOn (SkyFire)
* @project FoEngine
* @contacts ICQ: 2666440, MAIL: Folour@i.ua
* @copyright Folour Technologies, (c) 2012
*/
defined('FOLOUR') or exit('Access denied');
error_reporting(E_ALL & ~E_NOTICE);
ini_set('session.use_trans_sid', '0');
ini_set('arg_separator.output', '&');
ini_set('php_flag display_errors', '1');
ini_set('allow_url_fopen', '0');
date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
session_name('FoSess');
session_start();
$route = isset($_GET['route']) && preg_match('#(^[0-9a-z/]+)#i', $_GET['route']) ? explode('/', $_GET['route'], 5) : array();
if(!isset($_SESSION['ua']) && !isset($_SESSION['ip'])) {
$_SESSION['ip'] = (!empty($_SERVER['REMOTE_ADDR']) ? htmlspecialchars(getenv('REMOTE_ADDR'), ENT_QUOTES, 'UTF-8') : NULL);
$_SESSION['ua'] = (!empty($_SERVER['HTTP_USER_AGENT']) ? htmlspecialchars(substr(getenv('HTTP_USER_AGENT'), 0, 150), ENT_QUOTES, 'UTF-8') : NULL);
}
if(is_null($_SESSION['ua']) || is_null($_SESSION['ip']))
exit('Acces denied');
define ('INCDIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define ('MODULE', !empty($route[0]) ? $route[0] : 'index');
define ('ACT', !empty($route[1]) ? $route[1] : NULL);
define ('ID', !empty($route[2]) ? $route[2] : NULL);
define ('DSEP', DIRECTORY_SEPARATOR);
define ('ROOT', dirname(INCDIR) . DSEP);
define ('MODDIR', ROOT . 'modules' . DSEP);
define ('SUBMODDIR', MODDIR . 'includes' . DSEP);
spl_autoload_register(
function ($name) {
$name = strtolower($name);
$path = INCDIR . 'classes/' . $name . '.php';
if(file_exists($path))
require_once $path;
else
exit('Class ' . $name . ' not exists');
}
);
//Registry::instance() -> DB = new PDO('mysql:host=localhost;dbnam=foengine', 'foengine', 'password');
Registry::instance() -> functions = new Functions;
Registry::instance() -> core = new Core;
Registry::instance() -> user = new User;
if(!empty($_COOKIE['_UID_']) && !empty($_COOKIE['_UPASS_'])) {
define ('UID', abs(intval($_COOKIE['_UID_'])));
define ('UPASS', Registry::instance() -> functions -> xssClean($_COOKIE['_UPASS_']));
}
define ('STYLE', Registry::instance() -> user -> getStyle());
define ('MODULE_TPL_DIRECTORY', ROOT . 'modules' . DSEP . MODULE . DSEP . 'templates' . DSEP);
define ('DEFAULT_TPL_DIRECTORY', ROOT . 'style' . DSEP . STYLE . DSEP . 'templates' . DSEP);
define ('IP', $_SESSION['ip']);
define ('UA', $_SESSION['ua']);
define ('HOST', getenv('HTTP_HOST'));
Registry::instance() -> tpl = new Template;