Project

General

Profile

1
<?php 
2
/**
3
* @package   Warp Theme Framework
4
* @author    YOOtheme http://www.yootheme.com
5
* @copyright Copyright (C) YOOtheme GmbH
6
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
7
*/
8

    
9
// set gzip handler
10
if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) @ob_start('ob_gzhandler');
11

    
12
// include file
13
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
14

    
15
	$query = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $_SERVER['QUERY_STRING']);
16

    
17
	if (($file = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.$query)) && is_file($file)) {
18
		if ($type = pathinfo($file, PATHINFO_EXTENSION)) {
19
			
20
			// set header
21
			if ($type == 'css') header('Content-type: text/css; charset=UTF-8');
22
			if ($type == 'js') header('Content-type: application/x-javascript');
23
			header('Cache-Control: max-age=86400');
24

    
25
			// load file
26
			include($file);
27

    
28
		}
29
	}
30

    
31
}
    (1-1/1)