<?php

	if (!strstr($_GET["file"], "../")) {
		$filename = "../../../system/cache/temp/".$_GET["file"];
		if (is_file($filename)) {
			
			// required for IE, otherwise Content-disposition is ignored
			if(ini_get('zlib.output_compression'))
			ini_set('zlib.output_compression', 'Off');
			
			header("Pragma: public"); // required
			header("Expires: 0");
			header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
			header("Cache-Control: private",false);
			header("Content-Type: image/jpg");
			header("Content-Disposition: attachment; filename=".basename($filename).";" );
			header("Content-Transfer-Encoding: binary");
			header("Content-Length: ".filesize($filename));
			readfile("$filename");
			$mime = "application/save";
			
			unlink("system/cache/temp/".$_GET["file"]);
			
			exit();
		}
	} else {
		die("EOF");
	}
?>