Beispiel #1
0
    $ct = 'text/html; charset=UTF-8';
}
header('Content-Type: ' . $ct);
if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
    header('Content-Encoding: gzip');
    $indexcachefile = $CACHEDIR . "index.php.gz" . $br;
}
if ($MASKSRV) {
    header('X-Powered-By: Pigeons');
}
if (!file_has_changed($indexcachefile, "../index.php", $INCLUDEDIR . "init.inc", $INCLUDEDIR . "cache.inc", $INCLUDEDIR . "dynamic.inc")) {
    date_default_timezone_set('UTC');
    //header("ETag: \"".getETag($indexcachefile)."\"");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s \\G\\M\\T", filemtime($indexcachefile)));
    header("Expires: " . gmdate("D, d M Y H:i:s \\G\\M\\T", filemtime($indexcachefile) + $EXPIRETIME));
    if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == "\"" . getETag($indexcachefile) . "\"") {
        header("HTTP/1.0 304 Not Modified");
        exit;
    }
    if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= filemtime($indexcachefile)) {
        header("HTTP/1.0 304 Not Modified");
        exit;
    }
    ob_end_clean();
    echo file_get_contents($indexcachefile);
} else {
    $fp = fopen($indexcachefile, 'w');
    fwrite($fp, "");
    fclose($fp);
    date_default_timezone_set('UTC');
    //header("ETag: ",getETag($indexcachefile));
 function preRender()
 {
     _pf('Header preRender()');
     if (!($this->options & HDR_NO_CACHECONTROL) && getConfig('rss.output.cachecontrol')) {
         $etag = getETag();
         $hdrs = rss_getallheaders();
         if (array_key_exists('If-None-Match', $hdrs) && $hdrs['If-None-Match'] == $etag) {
             header("HTTP/1.1 304 Not Modified");
             flush();
             exit;
         } else {
             header('Last-Modified: ' . gmstrftime("%a, %d %b %Y %T %Z", getLastModif()));
             header("ETag: {$etag}");
         }
     }
     if (count($this->extraHeaders)) {
         foreach ($this->extraHeaders as $hdr) {
             header($hdr);
         }
     }
     rss_plugin_hook('rss.plugins.bodystart', null);
 }