Changeset 92

Show
Ignore:
Timestamp:
01/11/06 01:00:45 (3 years ago)
Author:
sven
Message:

more RSS HTTP

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/_files/rss2.php

    r88 r92  
    9595                                $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
    9696                                 
     97                                if (!$trackmaxtime) { 
     98                                        $trackmaxtime = time(); 
     99                                } 
     100                                 
    97101                                $lm = gmdate("D, d M Y H:i:s", $trackmaxtime) . " GMT"; 
    98102                                $etag = md5($output); 
  • devel/_weblog/rss091.php

    r45 r92  
    1616                $individual = 1; 
    1717                 
    18                 header("Content-type: text/xml"); 
     18                $output = ""; 
     19                $trackmaxtime = 0; 
    1920                 
    2021                if (isset($page_owner)) { 
    2122                         
    22                         echo <<< END 
     23                        $output .= <<< END 
    2324<?xml version="1.0"?><!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd"> 
    2425 
     
    3233                                $sitename = sitename; 
    3334                                $mainurl = htmlentities(url . $username . "/weblog/"); 
    34                                 echo <<< END 
     35                                $output .= <<< END 
    3536        <channel> 
    3637                <title>$name : Weblog</title> 
     
    4344                                        foreach($entries as $entry) { 
    4445                                                $title = htmlentities(stripslashes($entry->title)); 
     46                                                $trackmaxtime = max($trackmaxtime, $entry->posted); 
    4547                                                $link = url . $username . "/weblog/" . $entry->ident . ".html"; 
    4648                                                $body = (run("weblogs:text:process",stripslashes($entry->body))); 
    47                                                 echo <<< END 
     49                                                $output .= <<< END 
    4850                <item> 
    4951                        <title>$title</title> 
     
    5456                                        } 
    5557                                } 
    56                                 echo <<< END 
     58                                $output .= <<< END 
    5759        </channel> 
    5860</rss> 
    5961END; 
     62                        } 
     63                         
     64                        if ($output) { 
     65                                header("Pragma: public"); 
     66                                header("Cache-Control: public");  
     67                                header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); 
     68                                 
     69                                $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']); 
     70                                $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
     71                                 
     72                                if (!$trackmaxtime) { 
     73                                        $trackmaxtime = time(); 
     74                                } 
     75                                 
     76                                $lm = gmdate("D, d M Y H:i:s", $trackmaxtime) . " GMT"; 
     77                                $etag = md5($output); 
     78                                 
     79                                if ($if_modified_since == $lm) { 
     80                                        header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 
     81                                        exit; 
     82                                } 
     83                                if ($if_none_match == $etag) { 
     84                                        header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 
     85                                        exit; 
     86                                } 
     87                                 
     88                                // Send last-modified header to enable if-modified-since requests 
     89                                if ($tstamp < time()) { 
     90                                        header("Last-Modified: " . $lm); 
     91                                } 
     92                                 
     93                                header("Content-Length: " . strlen($output)); 
     94                                header('ETag: "' . $etag . '"'); 
     95                                 
     96                                header("Content-type: text/xml"); 
     97                                echo $output; 
     98                        } 
     99                         
     100                         
    60101                } 
    61         } 
  • devel/_weblog/rss2.php

    r88 r92  
    8989                                $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
    9090                                 
     91                                if (!$trackmaxtime) { 
     92                                        $trackmaxtime = time(); 
     93                                } 
     94                                 
    9195                                $lm = gmdate("D, d M Y H:i:s", $trackmaxtime) . " GMT"; 
    9296                                $etag = md5($output); 
  • devel/profile/rss2.php

    r88 r92  
    129129                                $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
    130130                                 
     131                                if (!$trackmaxtime) { 
     132                                        $trackmaxtime = time(); 
     133                                } 
     134                                 
    131135                                $lm = gmdate("D, d M Y H:i:s", $trackmaxtime) . " GMT"; 
    132136                                $etag = md5($output); 
  • devel/search/rss.php

    r45 r92  
    99                run("search:all:tagtypes"); 
    1010 
    11                 header("Content-Type: text/xml"); 
    12                 echo run("search:all:display:rss", $_REQUEST['tag']); 
     11                $output = run("search:all:display:rss", $_REQUEST['tag']); 
    1312                 
     13                if ($output) { 
     14                        header("Pragma: public"); 
     15                        header("Cache-Control: public");  
     16                         
     17                        // no time data on this RSS, at least not without rewriting some function outputs 
     18                         
     19                        $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
     20                         
     21                        $etag = md5($output); 
     22                         
     23                        if ($if_none_match == $etag) { 
     24                                header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 
     25                                exit; 
     26                        } 
     27                         
     28                        header("Content-Length: " . strlen($output)); 
     29                        header('ETag: "' . $etag . '"'); 
     30                         
     31                        header("Content-type: text/xml"); 
     32                        echo $output; 
     33                } 
    1434?>