Subversion Repositories cheapmusic

Rev

Rev 106 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 106 Rev 107
Line 5... Line 5...
5
$allowed = array('css','js','png','jpg','jpeg','gif','svg','ico');
5
$allowed = array('css','js','png','jpg','jpeg','gif','svg','ico');
6
 
6
 
7
//check for request variable existence and that file type is allowed
7
//check for request variable existence and that file type is allowed
8
if(isset($_GET['file']) && isset($_GET['type']) && in_array(substr($_GET['file'],strrpos($_GET['file'],'.')+1), $allowed)) {
8
if(isset($_GET['file']) && isset($_GET['type']) && in_array(substr($_GET['file'],strrpos($_GET['file'],'.')+1), $allowed)) {
9
	if (!$data = @file_get_contents(dirname(__FILE__).'/'.$_GET['file'])) { // grab the file contents
9
	if (!$data = @file_get_contents(dirname(__FILE__).'/'.$_GET['file'])) { // grab the file contents
10
            error_log(print_r($_SERVER, true));
-
 
11
            error_log(print_r($_GET, true));
-
 
12
            exit;
10
            exit;
13
        }
11
    }
14
 
12
 
15
	$etag = '"'.md5($data).'"'; // generate a file Etag
13
	$etag = '"'.md5($data).'"'; // generate a file Etag
16
	header('ETag: '.$etag); // output the Etag in the header
14
	header('ETag: '.$etag); // output the Etag in the header
17
 
15
 
18
	// output the content-type header for each file type
16
	// output the content-type header for each file type