From 749e079645be60dc0711817ca6d262a8a35f3ddf Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 30 Mar 2017 15:35:25 +0200 Subject: [PATCH] fixed system header transmit to match google criteria --- files/files.php | 1 + system/HEADER.php | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/files.php b/files/files.php index bd84f96..0c02c43 100644 --- a/files/files.php +++ b/files/files.php @@ -52,6 +52,7 @@ class files { $ext = pathinfo(self::$folders[$cat].$id); $ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : ''); + header("Last-Modified: " . gmdate('D, d M Y H:i:s \G\M\T', filemtime(self::$folders[$cat].$id))); if(\SYSTEM\HEADER::available($ext)){ call_user_func('\SYSTEM\HEADER::'.$ext); }else{ diff --git a/system/HEADER.php b/system/HEADER.php index 0e4199a..50e6cbb 100644 --- a/system/HEADER.php +++ b/system/HEADER.php @@ -56,7 +56,7 @@ class HEADER { */ public static function PNG(){ if(self::checkHeader()){ - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60))); // 1 hour + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week header('content-type:image/png;');}} /** * Send JPG Headers, if Header was not sent yet @@ -65,7 +65,7 @@ class HEADER { */ public static function JPG(){ if(self::checkHeader()){ - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60))); // 1 hour + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week header('content-type:image/jpeg;');}} /** * Send JPEG Headers, if Header was not sent yet @@ -74,7 +74,7 @@ class HEADER { */ public static function JPEG(){ if(self::checkHeader()){ - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60))); // 1 hour + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week header('content-type:image/jpeg;');}} /** * Send GIF Headers, if Header was not sent yet @@ -83,7 +83,7 @@ class HEADER { */ public static function GIF(){ if(self::checkHeader()){ - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60))); // 1 hour + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week header('content-type:image/gif;');}} /** * Send JS Headers, if Header was not sent yet @@ -100,6 +100,7 @@ class HEADER { */ public static function CSS(){ if(self::checkHeader()){ + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week header('content-type:text/css;');}} /** * Send LESS Headers, if Header was not sent yet