root/releases/0.1.1b/_weblog/rss2.php

Revision 2, 2.0 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     //    ELGG weblog RSS 0.91 page
4
5     // Run includes
6         require("../includes.php");
7         
8         run("profile:init");
9         run("friends:init");
10         run("weblogs:init");
11         
12         global $profile_id;
13         global $individual;
14         global $page_owner;
15         
16         $individual = 1;
17         
18         header("Content-type: text/xml");
19         
20         if (isset($page_owner)) {
21             
22             echo <<< END
23 <?xml version='1.0' encoding='UTF-8'?>
24 <rss version='2.0'   xmlns:dc='http://purl.org/dc/elements/1.1/'>
25 END;
26             $info = db_query("select * from users where ident = $page_owner");
27             if (sizeof($info) > 0) {
28                 $info = $info[0];
29                 $name = htmlentities(stripslashes($info->name));
30                 $username = htmlentities(stripslashes($info->username));
31                 $mainurl = htmlentities(url . $username . "/weblog/");
32                 echo <<< END
33   <channel xml:base='$mainurl'>
34     <title>$name : Weblog</title>
35     <description>The weblog for $name, hosted on Elgg.</description>
36     <language>en-gb</language>
37     <link>$mainurl</link>
38 END;
39                 $entries = db_query("select * from weblog_posts where owner = $page_owner and access = 'PUBLIC' order by posted desc limit 10");
40                 if (sizeof($entries) > 0) {
41                     foreach($entries as $entry) {
42                         $title = htmlentities(stripslashes($entry->title));
43                         $link = url . $username . "/weblog/" . $entry->ident . ".html";
44                         $body = htmlentities(run("weblogs:text:process",stripslashes($entry->body)));
45                         $pubdate = gmdate("D, d M Y H:i:s T", $entry->posted);
46                         $keywords = db_query("select * from tags where tagtype = 'weblog' and ref = '".$entry->ident."'");
47                         $keywordtags = "";
48                         if (sizeof($keywords) > 0) {
49                             foreach($keywords as $keyword) {
50                                 $keywordtags .= "\n        <dc:subject>".htmlentities(stripslashes($keyword->tag)) . "</dc:subject>";
51                             }
52                         }
53                         echo <<< END
54     <item>
55         <title>$title</title>
56         <link>$link</link>
57         <pubDate>$pubdate</pubDate>$keywordtags
58         <description>$body</description>
59     </item>
60 END;
61                     }
62                 }
63                 echo <<< END
64   </channel>
65 </rss>
66 END;
67         }
68     }
Note: See TracBrowser for help on using the browser.