root/releases/0.6rc2/_rss/static.php

Revision 269, 1.0 kB (checked in by ben, 3 years ago)

--

  • Property svn:eol-style set to native
Line 
1 <?php
2
3 require_once(dirname(dirname(__FILE__)).'/includes.php');
4
5 $userref = optional_param('userref');
6 $username = optional_param('username');
7 $type = optional_param('type');
8
9 $file = $CFG->dataroot.'rss/'.$userref.'/'.$username.'/'.$type.'.xml';
10
11 if (!file_exists($file)) {
12     @header('HTTP/1.0 404 Not Found');
13     exit;
14 }
15 header("Pragma: public");
16 header("Cache-Control: public");
17 header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT");
18
19
20 $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
21                     
22 $tstamp = filemtime($file);
23 $lm = gmdate("D, d M Y H:i:s", $tstamp) . " GMT";
24                     
25 if ($if_modified_since == $lm) {
26     header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified");
27     exit;
28 }
29                 
30 // Send last-modified header to enable if-modified-since requests
31 if ($tstamp < time()) {
32     header("Last-Modified: " . $lm);
33 }
34
35 header("Content-type: text/xml; charset=utf-8");
36 readfile($file);
37
38 ?>
Note: See TracBrowser for help on using the browser.