Update index.php

This commit is contained in:
Namhyeon Go 2018-04-13 14:27:39 +09:00 committed by GitHub
parent a2ba12014f
commit 9aa0287303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
<?php
/**
* @file index.php
* @date 2017-12-18
* @date 2018-04-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief ReasonableFramework
* @cvs http://github.com/gnh1201/reasonableframework
@ -16,10 +16,17 @@ $load_systems = array("base", "config", "database", "uri", "logger", "security")
foreach($load_systems as $system_name) {
$system_inc_file = "./system/" . $system_name . ".php";
if(file_exists($system_inc_file)) {
include_once($system_inc_file);
if($system_name == "base") {
include($system_inc_file);
} else {
include_isolate($system_inc_file, $scope);
}
}
}
// get config
$config = get_scope("config");
// set max_execution_time
$max_execution_time = get_value_in_array("max_execution_time", $config, 0);
@ini_set("max_execution_time", $max_execution_time);
@ -41,15 +48,16 @@ if(empty($route)) {
$route = get_value_in_array("default_route", $config, "welcome");
} else {
$route_names = explode('/', $route);
if(count($route) > 1) {
$route = end($route_names);
if(count($route_names) > 1) {
$route = $route_names[0];
}
}
// including route file
$route_file_name = "./route/" . $route . ".php";
if(file_exists($route_file_name)) {
include($route_file_name);
} else {
include("./route/errors/404.php");
if(!file_exists($route_file_name)) {
$route = "errors/404";
$route_file_name = "./route/" . $route . ".php";
}
include_isolate($route_file_name, $scope);
register_loaded("route", $route);