X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Fvier%2Fstyle.php;h=d777864825a11cf98b2aeb1d692ab1567b44d7b4;hb=2022d0e812d191acd47b8408f933dfb726a21b92;hp=e118d1ef0905cf77b11001f65156a11732c5fba0;hpb=aa9ceabdd9eeec82393e4d5f09aad09c181af33d;p=friendica.git diff --git a/view/theme/vier/style.php b/view/theme/vier/style.php index e118d1ef09..d777864825 100644 --- a/view/theme/vier/style.php +++ b/view/theme/vier/style.php @@ -1,30 +1,56 @@ $modified) { + $modified = $stylemodified; + } + } else { + //TODO: use LOGGER_ERROR? + logger('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')'); + } +} +$modified = gmdate('r', $modified); -echo $stylecss; +$etag = md5($stylecss); + +// Only send the CSS file if it was changed +header('Cache-Control: public'); +header('ETag: "'.$etag.'"'); +header('Last-Modified: '.$modified); +if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { + $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])); + $cached_etag = str_replace(['"', "-gzip"], ['', ''], + stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); + if (($cached_modified == $modified) && ($cached_etag == $etag)) { + header('HTTP/1.1 304 Not Modified'); + exit(); + } +} +echo $stylecss;