index.php<?php
error_reporting(-1);
define("KEY", true);
define("PATH", $_SERVER['DOCUMENT_ROOT']);
include './system/core.php';
if(Core::$_config['mode'] == 0)
{
ini_set('display_errors', 1);
} else {
ini_set('display_errors', 0);
set_error_handler('Error::PHP');
}
spl_autoload_register('Core::autload');
header('Content-Type: text/html; charset='.Core::$_config['charset']);
setlocale(LC_ALL, Core::$_config['locale']);
mb_internal_encoding(Core::$_config['mb_internal_encoding']);
mb_regex_encoding(Core::$_config['mb_regex_encoding']);
date_default_timezone_set(Core::$_config['timezone']);
session_start();
echo "Hello, world";
core.php<?php if(!defined('KEY')) {header("Location: /404.html"); die();}
class Core {
public static $_config = array(
'mode' => 0,
'mb_reges_encoding' => 'utf-8',
'mb_internal_encoding' => 'utf-8',
'charset' => 'utf-8',
'locale' => 'ru_RU.UTF-8',
'time_zone' => 'Europe/Moscow',
'default_tpl' => 'main.tpl',
'DRIVERS' => array(),
'MODULES' => array(),
'PAGES' => array(
'messages',
'friends',
'photos',
'jobs',
'work',
'support',
'help'
)
);
public static $var = 'echo';
public static function autoload($classname)
{
$drivers = Core::$_config['DRIVERS'];
$modules = Core::$_config['MODULES'];
if(in_array($classname, $drivers)){
require_once PATH . "/system/drivers/" . $classname . ".php";
}else if(in_array($classname, $modules)) {
require_once PATH . '/system/modules/' . $classname . '.php';
} else {
exit("Error");
}
}
}