$valid_extensions = array('css', 'js', 'jpg', 'jpeg', 'png', 'gif', 'txt', 'htc'); $root = $_SERVER['DOCUMENT_ROOT']; if (!isset($_GET['path'])) { $path = ltrim($_SERVER['REQUEST_URI'], '/'); } else { $path = ltrim($_GET['path'], '/'); } $path = $root . '/' . $path; $ext = ltrim(strrchr($path, '.'), '.'); if (file_exists($path) && in_array($ext, $valid_extensions)) { $mime = ""; switch ($ext) { case "css": $mime = "text/css"; require_once $root . '/php/http/cssparser.class.php'; $cachedPath = CSSParser::getBuiltCssFileName($path); if (file_exists($cachedPath)) { $path = $cachedPath; } break; case "js": $mime = "text/javascript"; break; case "txt": $mime = "text/plain"; break; case "htc": //ie htc behavior files $mime = "text/x-component"; default: if (is_executable('/usr/bin/file')) {