Created
August 9, 2013 08:01
-
-
Save ktmud/6191907 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/*by qiuchi @ 2010-11-03 */ | |
$uri = str_replace('index.php', '', $_SERVER["REQUEST_URI"]); | |
//echo $uri . "\n\n"; | |
if ( !strpos($uri, '??') ) { | |
include_once 'fetch.php'; | |
exit; | |
} | |
$filedir = substr($uri, 0, strpos($uri, '??')); | |
// echo $filedir."\n\n"; | |
$uri = str_replace($filedir.'??', '', $uri); | |
$filelist = preg_replace('/\?t=.*/s', '', $uri); | |
$files = explode(',', $filelist); | |
header('HTTP/1.0 200 OK'); | |
if (strpos('css', $uri) !== -1) { | |
header('Content-type: text/css'); | |
} else { | |
header('Content-type: text/javascript'); | |
} | |
echo '/* combo of '.$filelist." */"; | |
foreach ($files as $file) { | |
$file = $filedir.$file; | |
echo "\n\n/*----- ". $file ." ----*/\n"; | |
$localfile = $_SERVER['DOCUMENT_ROOT'].$file; | |
$file = 'http://localhost'.$file; | |
if (file_exists($localfile)) { | |
$file = $localfile; | |
} | |
if ($fp = @fopen($file, "r")){ | |
$contents = stream_get_contents($fp); | |
echo $contents; | |
fclose($fp); | |
} else { | |
echo ''; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment