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