0) { // Re-send headers header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $mod_time)); header('Expires: '.gmdate('D, d M Y H:i:s T', time() + $mod_time_diff)); header('Cache-Control: max-age='.$mod_time_diff); header('Status: 304 Not Modified', TRUE, 304); // Prevent any output Event::add('system.display', array('expires', 'prevent_output')); // Exit to prevent other output exit; } } return FALSE; } /** * Check headers already created to not step on download or Img_lib's feet * * @return boolean */ public static function check_headers() { foreach (headers_list() as $header) { if ((session_cache_limiter() == '' AND stripos($header, 'Last-Modified:') === 0) OR stripos($header, 'Expires:') === 0) { return FALSE; } } return TRUE; } /** * Prevent any output from being displayed. Executed during system.display. * * @return void */ public static function prevent_output() { Kohana::$output = ''; } } // End expires