44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
ini_set("display_errors", "stdout");
 | 
						|
error_reporting(E_ALL);
 | 
						|
 | 
						|
require_once './modules/InterfaceConfig.php';
 | 
						|
require_once './modules/InterfacePostgreSQL.php';
 | 
						|
require_once './modules/ClassConfig.php';
 | 
						|
$oConf = new ClassConfig();
 | 
						|
 | 
						|
$file_path = substr_replace($_SERVER['REQUEST_URI'], '/', 0, strlen($oConf->getURLRoot()));
 | 
						|
 | 
						|
$custom_file = $oConf->getPathCustom($file_path);
 | 
						|
$native_file = $oConf->getPathRoot($file_path);
 | 
						|
 | 
						|
if(file_exists($custom_file)){
 | 
						|
  $file = $custom_file;
 | 
						|
} elseif(file_exists($native_file)) {
 | 
						|
  $file = $native_file;
 | 
						|
} else {
 | 
						|
  header('HTTP/1.1 404 Not found', true);
 | 
						|
  exit(0);
 | 
						|
}
 | 
						|
 | 
						|
$is_css = preg_match('/\.css$/', $file);
 | 
						|
$is_js = preg_match('/\.js$/', $file);
 | 
						|
$is_php = preg_match('/\.php$/', $file);
 | 
						|
 | 
						|
if($is_php){
 | 
						|
  include($file);
 | 
						|
  exit(0);
 | 
						|
} else if($is_css){
 | 
						|
  $type = 'text/css';
 | 
						|
} else if($is_js){
 | 
						|
  $type = 'text/javascript';
 | 
						|
} else {
 | 
						|
  $finfo = finfo_open(FILEINFO_MIME_TYPE);
 | 
						|
  $type = finfo_file($finfo, $file);
 | 
						|
  finfo_close($finfo);
 | 
						|
}
 | 
						|
 | 
						|
header('Content-Type: ' . $type, true);
 | 
						|
 | 
						|
echo file_get_contents($file);
 |