Update index.php
This commit is contained in:
parent
082a7002cc
commit
5b235d644e
31
index.php
31
index.php
|
@ -3,45 +3,42 @@
|
||||||
* @file index.php
|
* @file index.php
|
||||||
* @date 2017-12-18
|
* @date 2017-12-18
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||||
* @brief VerySimplePHPFramework
|
* @brief ReasonableFramework
|
||||||
* @cvs http://github.com/gnh1201/verysimplephpframework
|
* @cvs http://github.com/gnh1201/reasonableframework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("_DEF_VSPF_", true);
|
define("_DEF_VSPF_", true);
|
||||||
ini_set("max_execution_time", 0);
|
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set("display_errors", 1);
|
|
||||||
|
|
||||||
// define system modules
|
// define system modules
|
||||||
$load_systems = array('base', 'config', 'database', 'uri', 'logger', 'security');
|
$load_systems = array("base", "config", "database", "uri", "logger", "security");
|
||||||
|
|
||||||
// load system modules
|
// load system modules
|
||||||
foreach($load_systems as $system_name) {
|
foreach($load_systems as $system_name) {
|
||||||
$system_inc_file = './system/' . $system_name . '.php';
|
$system_inc_file = "./system/" . $system_name . ".php";
|
||||||
if(file_exists($system_inc_file)) {
|
if(file_exists($system_inc_file)) {
|
||||||
include_once($system_inc_file);
|
include_once($system_inc_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set max_execution_time
|
||||||
|
$max_execution_time = get_value_in_array("max_execution_time", $config, 0);
|
||||||
|
@ini_set("max_execution_time", $max_execution_time);
|
||||||
|
|
||||||
// autoload module
|
// autoload module
|
||||||
if(!array_key_empty('enable_autoload', $config)) {
|
if(!array_key_empty("enable_autoload", $config)) {
|
||||||
loadModule("autoload");
|
loadModule("autoload");
|
||||||
}
|
}
|
||||||
|
|
||||||
// set timezone
|
// set timezone
|
||||||
$default_timezone = array_key_empty("timezone", $config) ? $config['timezone'] : "UTC";
|
$default_timezone = get_value_in_array("timezone", $config, "UTC");
|
||||||
date_default_timezone_set($default_timezone);
|
date_default_timezone_set($default_timezone);
|
||||||
|
|
||||||
// route controller
|
// route controller
|
||||||
$route = '';
|
$route = get_value_in_array("route", $_REQUEST, "");
|
||||||
if(!array_key_empty('route', $_REQUEST)) {
|
|
||||||
$route = $_REQUEST['route'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// load route
|
// load route
|
||||||
if(empty($route)) {
|
if(empty($route)) {
|
||||||
$route = array_key_empty('default_route', $config) ? 'welcome' : $config['default_route'];
|
$route = "welcome";
|
||||||
} else {
|
} else {
|
||||||
$route_names = explode('/', $route);
|
$route_names = explode('/', $route);
|
||||||
if(count($route) > 1) {
|
if(count($route) > 1) {
|
||||||
|
@ -50,9 +47,9 @@ if(empty($route)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// including route file
|
// including route file
|
||||||
$route_file_name = './route/' . $route . '.php';
|
$route_file_name = "./route/" . $route . ".php";
|
||||||
if(file_exists($route_file_name)) {
|
if(file_exists($route_file_name)) {
|
||||||
include($route_file_name);
|
include($route_file_name);
|
||||||
} else {
|
} else {
|
||||||
include('./route/errors/404.php');
|
include("./route/errors/404.php");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user