+ if ($lifetime > 0 && !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
+ // get unixtime of request header; clip extra junk off first
+ $since = strtotime(preg_replace('/;.*$/','',$_SERVER["HTTP_IF_MODIFIED_SINCE"]));
+ if ($since && $since >= $lastmodified) {
+ header('HTTP/1.1 304 Not Modified');
+ header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
+ header('Cache-Control: max-age='.$lifetime);
+ header('Content-Type: '.$mimetype);
+ if ($dontdie) {
+ return;
+ }
+ die;
+ }
+ }
+