| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 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 |
$sitename = htmlentities(sitename); |
|---|
| 19 |
|
|---|
| 20 |
header("Content-type: text/xml"); |
|---|
| 21 |
|
|---|
| 22 |
if (isset($page_owner)) { |
|---|
| 23 |
|
|---|
| 24 |
echo <<< END |
|---|
| 25 |
<?xml version='1.0' encoding='UTF-8'?> |
|---|
| 26 |
<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'> |
|---|
| 27 |
END; |
|---|
| 28 |
$info = db_query("select * from users where ident = $page_owner"); |
|---|
| 29 |
if (sizeof($info) > 0) { |
|---|
| 30 |
$info = $info[0]; |
|---|
| 31 |
$name = htmlentities(stripslashes($info->name)); |
|---|
| 32 |
$username = htmlentities(stripslashes($info->username)); |
|---|
| 33 |
$mainurl = htmlentities(url . $username . "/weblog/"); |
|---|
| 34 |
echo <<< END |
|---|
| 35 |
<channel xml:base='$mainurl'> |
|---|
| 36 |
<title>$name : Weblog</title> |
|---|
| 37 |
<description>The weblog for $name, hosted on $sitename.</description> |
|---|
| 38 |
<language>en-gb</language> |
|---|
| 39 |
<link>$mainurl</link> |
|---|
| 40 |
END; |
|---|
| 41 |
if (!isset($_REQUEST['tag'])) { |
|---|
| 42 |
$entries = db_query("select * from weblog_posts where weblog = $page_owner and access = 'PUBLIC' order by posted desc limit 10"); |
|---|
| 43 |
} else { |
|---|
| 44 |
$tag = addslashes($_REQUEST['tag']); |
|---|
| 45 |
$entries = db_query("select weblog_posts.* from tags left join weblog_posts on weblog_posts.ident = tags.ref where weblog_posts.weblog = $page_owner and weblog_posts.access = 'PUBLIC' and tags.tag = '$tag' and tags.tagtype = 'weblog' order by weblog_posts.posted desc limit 10"); |
|---|
| 46 |
} |
|---|
| 47 |
if (sizeof($entries) > 0) { |
|---|
| 48 |
foreach($entries as $entry) { |
|---|
| 49 |
$title = htmlentities(stripslashes($entry->title)); |
|---|
| 50 |
$link = url . $username . "/weblog/" . $entry->ident . ".html"; |
|---|
| 51 |
$body = htmlentities(run("weblogs:text:process",stripslashes($entry->body))); |
|---|
| 52 |
$pubdate = gmdate("D, d M Y H:i:s T", $entry->posted); |
|---|
| 53 |
$keywords = db_query("select * from tags where tagtype = 'weblog' and ref = '".$entry->ident."'"); |
|---|
| 54 |
$keywordtags = ""; |
|---|
| 55 |
if (sizeof($keywords) > 0) { |
|---|
| 56 |
foreach($keywords as $keyword) { |
|---|
| 57 |
$keywordtags .= "\n <dc:subject>".htmlentities(stripslashes($keyword->tag)) . "</dc:subject>"; |
|---|
| 58 |
} |
|---|
| 59 |
} |
|---|
| 60 |
echo <<< END |
|---|
| 61 |
<item> |
|---|
| 62 |
<title>$title</title> |
|---|
| 63 |
<link>$link</link> |
|---|
| 64 |
<pubDate>$pubdate</pubDate>$keywordtags |
|---|
| 65 |
<description>$body</description> |
|---|
| 66 |
</item> |
|---|
| 67 |
END; |
|---|
| 68 |
} |
|---|
| 69 |
} |
|---|
| 70 |
echo <<< END |
|---|
| 71 |
</channel> |
|---|
| 72 |
</rss> |
|---|
| 73 |
END; |
|---|
| 74 |
} |
|---|
| 75 |
} |
|---|