| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
// this is now only used for tag-search feeds |
|---|
| 5 |
|
|---|
| 6 |
// Run includes |
|---|
| 7 |
require("../includes.php"); |
|---|
| 8 |
|
|---|
| 9 |
run("profile:init"); |
|---|
| 10 |
run("friends:init"); |
|---|
| 11 |
run("weblogs:init"); |
|---|
| 12 |
|
|---|
| 13 |
global $page_owner; |
|---|
| 14 |
|
|---|
| 15 |
if (isset($page_owner)) { |
|---|
| 16 |
|
|---|
| 17 |
$username = run("users:id_to_name", $page_owner); |
|---|
| 18 |
if ($username) { |
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
$sitename = sitename; |
|---|
| 40 |
|
|---|
| 41 |
$output = ""; |
|---|
| 42 |
|
|---|
| 43 |
$tag = trim($_REQUEST['tag']); |
|---|
| 44 |
|
|---|
| 45 |
$rssweblog = sprintf(gettext("Weblog items tagged with %s"),$tag); |
|---|
| 46 |
|
|---|
| 47 |
$info = db_query("select * from users where ident = $page_owner"); |
|---|
| 48 |
sizeof($info) > 0) { |
|---|
| 49 |
$info = $info[0]; |
|---|
| 50 |
$name = (stripslashes($info->name)); |
|---|
| 51 |
$url = url; |
|---|
| 52 |
$username = (stripslashes($info->username)); |
|---|
| 53 |
$mainurl = (url . $username . "/weblog/"); |
|---|
| 54 |
$rssurl = $mainurl . "rss/" . urlencode(trim($_REQUEST['tag'])); |
|---|
| 55 |
$rssdescription = sprintf(gettext("The weblog for %s, hosted on %s."),$name,$sitename); |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
$output .= <<< END |
|---|
| 60 |
<?xml-stylesheet type="text/xsl" href="{$rssurl}/rssstyles.xsl"?> |
|---|
| 61 |
|
|---|
| 62 |
<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'> |
|---|
| 63 |
<channel xml:base='$mainurl'> |
|---|
| 64 |
<title><![CDATA[$name : $rssweblog]]></title> |
|---|
| 65 |
<description><![CDATA[$rssdescription]]></description> |
|---|
| 66 |
<link>$mainurl</link> |
|---|
| 67 |
END; |
|---|
| 68 |
|
|---|
| 69 |
if (isset($_REQUEST['modifier']) && $_REQUEST['modifier'] == "not") { |
|---|
| 70 |
$output .= run("weblogs:rss:getitems", array($page_owner, 10, $tag,"not")); |
|---|
| 71 |
} else { |
|---|
| 72 |
$output .= run("weblogs:rss:getitems", array($page_owner, 10, $tag,"")); |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
$output .= <<< END |
|---|
| 76 |
|
|---|
| 77 |
</channel> |
|---|
| 78 |
</rss> |
|---|
| 79 |
END; |
|---|
| 80 |
} |
|---|
| 81 |
|
|---|
| 82 |
if ($output) { |
|---|
| 83 |
header("Pragma: public"); |
|---|
| 84 |
header("Cache-Control: public"); |
|---|
| 85 |
header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); |
|---|
| 86 |
|
|---|
| 87 |
$if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); |
|---|
| 88 |
|
|---|
| 89 |
$etag = md5($output); |
|---|
| 90 |
header('ETag: "' . $etag . '"'); |
|---|
| 91 |
|
|---|
| 92 |
if ($if_none_match == $etag) { |
|---|
| 93 |
header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); |
|---|
| 94 |
exit; |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
header("Content-Length: " . strlen($output)); |
|---|
| 98 |
|
|---|
| 99 |
header("Content-type: text/xml"); |
|---|
| 100 |
echo $output; |
|---|
| 101 |
} |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
|
|---|