<?
if ($sys['path']) {
	$fromfolder	= $fm->dirname($str->fromHTML($sys['path']));
	$filename = $fm->basename($str->fromHTML($sys['path']));
} else {
	$fromfolder	= $str->fromHTML($_GET['fromfolder']);
	$filename = $str->fromHTML($_GET['filename']);
}

$base_dir = gluePath($permissions['path'], $fromfolder);
$path = gluePath($base_dir, $filename);


if (!isCleanPath($fromfolder)) {
die();
}
if (!isCleanFilename($filename)) {
die();
}

if ($permissions['unlimitedTraffic'] || $quota->canAddTraffic()) {
		if (file_exists($path)) {
			header("Cache-Control: private");
			
			
			$size = @getimagesize($path);
			$mime = $size['mime'];
			//$mime = @mime_content_type($fm->basename($path));
				if ($mime) {
					header("Content-Type: ".$mime."");
				} else {
					header("Content-Type: image/gif");
				}
			header("Content-Disposition: inline; filename=".$fm->basename($path)."");
			header("Content-Length: ".@filesize($path));
			readfile($path);
			exit();
			}
} else {
	echo $lang->get("Traffic quota exceeded.");
}
?>