2017-12-17 20:40:04 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* VerySimplePHPFramework
|
2017-12-22 18:41:57 +00:00
|
|
|
* http://github.com/gnh1201/verysimplephpframework
|
2017-12-17 20:40:04 +00:00
|
|
|
* Go Namhyeon <gnh1201@gmail.com>
|
2017-12-25 10:19:42 +00:00
|
|
|
* Date: 2017-12-18
|
2017-12-17 20:40:04 +00:00
|
|
|
*/
|
|
|
|
|
2017-12-22 19:04:01 +00:00
|
|
|
define("_DEF_VSPF_", true);
|
2017-12-25 10:19:42 +00:00
|
|
|
ini_set("max_execution_time", 0);
|
2017-12-22 19:04:01 +00:00
|
|
|
|
2017-12-31 18:31:24 +00:00
|
|
|
error_reporting(E_ALL);
|
|
|
|
ini_set("display_errors", 1);
|
|
|
|
|
2017-12-17 20:40:04 +00:00
|
|
|
// including vendor autoloader
|
|
|
|
include_once('./vendor/autoload.php');
|
|
|
|
|
2017-12-22 18:34:40 +00:00
|
|
|
// load system files
|
2017-12-31 16:16:00 +00:00
|
|
|
$load_systems = array('base', 'config', 'database', 'uri');
|
2017-12-22 18:34:40 +00:00
|
|
|
foreach($load_systems as $system_name) {
|
|
|
|
$system_inc_file = './system/' . $system_name . '.php';
|
|
|
|
if(file_exists($system_inc_file)) {
|
|
|
|
include_once($system_inc_file);
|
|
|
|
}
|
|
|
|
}
|
2017-12-17 20:40:04 +00:00
|
|
|
|
|
|
|
// route controller
|
|
|
|
$route = '';
|
|
|
|
if(array_key_exists('route', $_REQUEST)) {
|
|
|
|
$route = $_REQUEST['route'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($route)) {
|
2017-12-31 18:31:24 +00:00
|
|
|
$route = 'index';
|
2017-12-17 20:40:04 +00:00
|
|
|
} else {
|
|
|
|
$route_names = explode('/', $route);
|
|
|
|
if(count($route) > 1) {
|
|
|
|
$route = end($route_names);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// including route file
|
2017-12-25 10:19:42 +00:00
|
|
|
$route_file_name = './route/' . $route . '.php';
|
|
|
|
if(file_exists($route_file_name)) {
|
2017-12-25 10:20:28 +00:00
|
|
|
include($route_file_name);
|
2017-12-25 10:19:42 +00:00
|
|
|
} else {
|
2017-12-31 18:31:24 +00:00
|
|
|
include('./route/errors/404.php');
|
2017-12-25 10:19:42 +00:00
|
|
|
}
|