blob: 77932e5fbe6a4ce3c9919026936c5d3ba63b6611 [file] [log] [blame]
<?php
require_once '../../resources/portabilityLayer.php';
clearstatcache();
if (file_exists(sys_get_temp_dir() . "/" . $_GET["test"] . "_state")) {
header('HTTP/1.1 404 Not Found');
exit();
} else {
$tmpFile = fopen(sys_get_temp_dir() . "/" . $_GET["test"] . "_state", 'w');
fclose($tmpFile);
$filename = 'compass-no-cache.jpg';
$filemtime = filemtime($filename);
$filesize = filesize($filename);
$etag = '"' . $filesize . '-' . $filemtime . '"';
$last_modified = gmdate(DATE_RFC1123, $filemtime);
$max_age = 12 * 31 * 24 * 60 * 60; //one year
$expires = gmdate(DATE_RFC1123, time() + $max_age);
$handle = fopen($filename, 'rb');
$contents = fread($handle, $filesize);
fclose($handle);
header('Cache-Control: public, max-age=' . $max_age);
header('Expires: ' . $expires);
header('Content-Type: image/png');
header('Content-Length: ' . $filesize);
header('Etag: ' . $etag);
header('Last-Modified: ' . $last_modified);
echo $contents;
exit();
}
?>