reasonableframework/index.php

60 lines
1.4 KiB
PHP
Raw Normal View History

2017-12-17 20:40:04 +00:00
<?php
2017-12-31 18:34:33 +00:00
/**
2018-04-13 05:38:16 +00:00
* @file index.php
2018-04-13 05:27:39 +00:00
* @date 2018-04-13
2017-12-31 18:34:33 +00:00
* @author Go Namhyeon <gnh1201@gmail.com>
2018-04-13 05:38:16 +00:00
* @brief ReasonableFramework
* @cvs http://github.com/gnh1201/reasonableframework
2017-12-17 20:40:04 +00:00
*/
2018-04-13 05:38:16 +00:00
define("_DEF_VSPF_", true);
2017-12-31 18:31:24 +00:00
2018-04-13 05:38:16 +00:00
// define system modules
$load_systems = array("base", "config", "database", "uri", "logger", "security");
2018-02-26 04:20:46 +00:00
2018-04-13 05:38:16 +00:00
// load system modules
foreach($load_systems as $system_name) {
$system_inc_file = "./system/" . $system_name . ".php";
if(file_exists($system_inc_file)) {
if($system_name == "base") {
include($system_inc_file);
} else {
include_isolate($system_inc_file, $scope);
2018-04-13 05:37:28 +00:00
}
}
2017-12-25 10:19:42 +00:00
}
2018-04-13 05:37:28 +00:00
2018-04-13 05:38:16 +00:00
// get config
$config = get_scope("config");
2018-04-13 05:37:28 +00:00
2018-04-13 05:38:16 +00:00
// set max_execution_time
$max_execution_time = get_value_in_array("max_execution_time", $config, 0);
@ini_set("max_execution_time", $max_execution_time);
2018-04-13 05:37:28 +00:00
2018-04-13 05:38:16 +00:00
// autoload module
if(!array_key_empty("enable_autoload", $config)) {
loadModule("autoload");
2018-04-13 05:37:28 +00:00
}
2018-04-13 05:38:16 +00:00
// set timezone
$default_timezone = get_value_in_array("timezone", $config, "UTC");
date_default_timezone_set($default_timezone);
2018-04-13 05:37:28 +00:00
2018-04-13 05:38:16 +00:00
// route controller
$route = get_value_in_array("route", $_REQUEST, "");
2018-04-13 05:37:28 +00:00
2018-04-13 05:38:16 +00:00
// load route
if(empty($route)) {
$route = get_value_in_array("default_route", $config, "welcome");
} else {
$route_names = explode('/', $route);
if(count($route_names) > 1) {
$route = $route_names[0];
2018-04-13 05:37:28 +00:00
}
}
2018-04-13 05:38:16 +00:00
// load route file
if(!loadRoute($route, $scope)) {
loadRoute("errors/404", $scope);
2018-04-13 05:37:28 +00:00
}