91 lines
1.8 KiB
PHP
91 lines
1.8 KiB
PHP
<?php
|
|
|
|
use PhangoApp\PhaUtils\Utils;
|
|
|
|
ob_start();
|
|
|
|
//include('libraries/Utils.php');
|
|
//include('libraries/Routes.php');
|
|
|
|
if(is_file(__DIR__.'/vendor/autoload.php')) {
|
|
|
|
include(__DIR__.'/vendor/autoload.php');
|
|
|
|
}
|
|
|
|
//ob_start();
|
|
|
|
spl_autoload_register(function($class_name) {
|
|
|
|
//Simple autoload for modules, first element is module, second element is the file to load.
|
|
|
|
$arr_library=explode('\\', $class_name);
|
|
|
|
if(count($arr_library)>1) {
|
|
|
|
$module=strtolower($arr_library[0]);
|
|
|
|
$last_path=implode('/', array_slice($arr_library, 1, count($arr_library)));
|
|
|
|
$library=strtolower($last_path);
|
|
|
|
if(is_file('modules/'.$module.'/libraries/'.$library.'.php')) {
|
|
|
|
include('modules/'.$module.'/libraries/'.$library.'.php');
|
|
|
|
}
|
|
else if(is_file('modules/'.$module.'/libraries/'.strtolower($arr_library[1]).'.php')) {
|
|
|
|
include_once('modules/'.$module.'/libraries/'.strtolower($arr_library[1]).'.php');
|
|
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
|
|
Utils::load_config('config');
|
|
|
|
if(!PhangoApp\PhaRouter\Config::$on_other) {
|
|
|
|
if(!PhangoApp\PhaRouter\Config::$get_path_info) {
|
|
|
|
$path_info=isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
|
|
|
}
|
|
else {
|
|
|
|
$path_info=str_replace(PhangoApp\PhaRouter\Config::$base_url.'index.php', '', $_SERVER['REQUEST_URI']);
|
|
|
|
if($path_info===PhangoApp\PhaRouter\Config::$base_url) {
|
|
|
|
$path_info='';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else {
|
|
|
|
if(!isset($_GET['path_info'])) {
|
|
|
|
$path_info='';
|
|
|
|
}
|
|
else {
|
|
|
|
$path_info=$_GET['path_info'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo \PhangoApp\PhaRouter\get_route($path_info);
|
|
|
|
//ob_end_flush();
|
|
$final_content=ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
echo $final_content;
|