Update index.php

This commit is contained in:
Namhyeon Go 2018-02-26 13:20:46 +09:00 committed by GitHub
parent af41bbc170
commit fa1df12aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
* @file index.php
* @date 2017-12-18
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief ReasonablePHPFramework
* @brief VerySimplePHPFramework
* @cvs http://github.com/gnh1201/verysimplephpframework
*/
@ -13,11 +13,10 @@ ini_set("max_execution_time", 0);
error_reporting(E_ALL);
ini_set("display_errors", 1);
// including vendor autoloader
include_once('./vendor/autoload.php');
// load system files
// define system modules
$load_systems = array('base', 'config', 'database', 'uri', 'logger', 'security');
// load system modules
foreach($load_systems as $system_name) {
$system_inc_file = './system/' . $system_name . '.php';
if(file_exists($system_inc_file)) {
@ -25,21 +24,24 @@ foreach($load_systems as $system_name) {
}
}
// autoload module
if(array_key_empty('enable_autoload', $config)) {
loadModule("autoload");
}
// set timezone
$default_timezone = array_key_empty("timezone", $config) ? $config['timezone'] : "UTC";
date_default_timezone_set($default_timezone);
// start session (enable $_SESSION)
session_start();
// route controller
$route = '';
if(array_key_exists('route', $_REQUEST)) {
if(!array_key_empty('route', $_REQUEST)) {
$route = $_REQUEST['route'];
}
// load route
if(empty($route)) {
$route = 'index';
$route = 'welcome';
} else {
$route_names = explode('/', $route);
if(count($route) > 1) {