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-05-26 17:06:42 +00:00
|
|
|
* @date 2018-05-27
|
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-08-24 14:49:15 +00:00
|
|
|
define("_DEF_VSPF_", true); // compatible to VSPF
|
|
|
|
define("_DEF_RSF_", true); // compatible to RSF
|
2019-02-19 16:21:01 +00:00
|
|
|
define("APP_DEVELOPMENT", false); // set the status of development
|
|
|
|
define("DOC_EOL", "\r\n"); // set the 'end of line' commonly
|
2019-02-19 16:17:33 +00:00
|
|
|
|
|
|
|
// check if current status is development
|
|
|
|
if(APP_DEVELOPMENT == true) {
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
ini_set("display_errors", 1);
|
|
|
|
}
|
2017-12-31 18:31:24 +00:00
|
|
|
|
2018-04-13 05:38:16 +00:00
|
|
|
// define system modules
|
2018-05-26 17:34:57 +00:00
|
|
|
$load_systems = array("base", "storage", "config", "database", "uri", "security", "logger");
|
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);
|
2018-05-25 17:14:44 +00:00
|
|
|
register_loaded("system", $system_inc_file);
|
2018-04-13 05:38:16 +00:00
|
|
|
} else {
|
2018-05-25 17:16:37 +00:00
|
|
|
loadModule($system_name);
|
2018-04-13 05:37:28 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-25 10:19:42 +00:00
|
|
|
}
|
2018-04-13 06:11:47 +00:00
|
|
|
|
2018-04-13 06:12:15 +00:00
|
|
|
$config = get_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-12-29 04:23:07 +00:00
|
|
|
// set autoloader
|
2018-04-13 05:38:16 +00:00
|
|
|
if(!array_key_empty("enable_autoload", $config)) {
|
2018-12-29 04:23:07 +00:00
|
|
|
set_autoloader();
|
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-05-26 17:43:47 +00:00
|
|
|
// write visit log
|
|
|
|
write_visit_log();
|
|
|
|
|
2019-02-22 14:35:58 +00:00
|
|
|
// get route (controller)
|
|
|
|
$route = read_route();
|
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
|
|
|
}
|