root/releases/0.6rc2/profile/rss2.php

Revision 296, 2.1 kB (checked in by carmartin, 3 years ago)

Includes should use full path given that we know where things are. Patch 1.

  • Property svn:eol-style set to native
Line 
1 <?php
2 global $CFG;
3 //    ELGG aggregated RSS 2.0 page
4 // this is now only used for tag-search feeds
5
6 // Run includes
7 require_once(dirname(dirname(__FILE__))."/includes.php");
8
9 run("weblogs:init");
10 run("profile:init");
11
12 global $individual;
13 global $page_owner;
14
15 $individual = 1;
16
17 $sitename = (sitename);
18
19 $tag = trim(optional_param('tag'));
20
21 $output = "";
22
23 if (isset($page_owner)) {
24     
25     $rssactivity = sprintf(gettext("Activity tagged with %s"),$tag);
26     
27     if ($info = get_record('users','ident',$page_owner)) {
28         $name = (stripslashes($info->name));
29         $username = (stripslashes($info->username));
30         $mainurl = (url . $username . "/");
31         $rssurl = $mainurl . "rss/" . urlencode(trim($tag));
32         $url = url;
33         $rssdescription = sprintf(gettext("Activity for %s, hosted on %s."),$name,$sitename);
34         $output .= <<< END
35 <?xml-stylesheet type="text/xsl" href="{$rssurl}/rssstyles.xsl"?>
36 <rss version='2.0'   xmlns:dc='http://purl.org/dc/elements/1.1/'>
37     <channel xml:base='$mainurl'>
38         <title><![CDATA[$name : $rssactivity]]></title>
39         <description><![CDATA[$rssdescription]]></description>
40         <link>$mainurl</link>
41 END;
42         // WEBLOGS
43         $output .= run("weblogs:rss:getitems", array($page_owner, 10, $tag));
44         
45         // FILES
46         $output .= run("files:rss:getitems", array($page_owner, 10, $tag));
47         
48         $output .= <<< END
49
50     </channel>
51 </rss>
52 END;
53     }
54     
55     if ($output) {
56         header("Pragma: public");
57         header("Cache-Control: public");
58         header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT");
59         
60         $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']);
61         
62         $etag = md5($output);
63         header('ETag: "' . $etag . '"');
64         
65         if ($if_none_match == $etag) {
66             header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified");
67             exit;
68         }
69         
70         header("Content-Length: " . strlen($output));
71         
72         header("Content-type: text/xml; charset=utf-8");
73         echo $output;
74     }
75 }
Note: See TracBrowser for help on using the browser.