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 <?php
/** /**
* @file index.php * @file index.php
* @date 2017-12-18 * @date 2018-04-13
* @author Go Namhyeon <gnh1201@gmail.com> * @author Go Namhyeon <gnh1201@gmail.com>
* @brief ReasonableFramework * @brief ReasonableFramework
* @cvs http://github.com/gnh1201/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) { 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); 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 // set max_execution_time
$max_execution_time = get_value_in_array("max_execution_time", $config, 0); $max_execution_time = get_value_in_array("max_execution_time", $config, 0);
@ini_set("max_execution_time", $max_execution_time); @ini_set("max_execution_time", $max_execution_time);
@ -41,15 +48,16 @@ if(empty($route)) {
$route = get_value_in_array("default_route", $config, "welcome"); $route = get_value_in_array("default_route", $config, "welcome");
} else { } else {
$route_names = explode('/', $route); $route_names = explode('/', $route);
if(count($route) > 1) { if(count($route_names) > 1) {
$route = end($route_names); $route = $route_names[0];
} }
} }
// 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); $route = "errors/404";
} else { $route_file_name = "./route/" . $route . ".php";
include("./route/errors/404.php");
} }
include_isolate($route_file_name, $scope);
register_loaded("route", $route);