| 1 |
<?php |
|---|
| 2 |
global $CFG; |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
require_once(dirname(dirname(__FILE__))."/includes.php"); |
|---|
| 8 |
|
|---|
| 9 |
run("profile:init"); |
|---|
| 10 |
run("friends:init"); |
|---|
| 11 |
run("files:init"); |
|---|
| 12 |
|
|---|
| 13 |
global $profile_id; |
|---|
| 14 |
global $individual; |
|---|
| 15 |
global $page_owner; |
|---|
| 16 |
|
|---|
| 17 |
$individual = 1; |
|---|
| 18 |
|
|---|
| 19 |
$sitename = htmlspecialchars(sitename, ENT_COMPAT, 'utf-8'); |
|---|
| 20 |
$tag = trim(optional_param('tag')); |
|---|
| 21 |
$output = ""; |
|---|
| 22 |
|
|---|
| 23 |
if (isset($profile_id)) { |
|---|
| 24 |
|
|---|
| 25 |
$rssfiles = sprintf(gettext("Files tagged with %s"),$tag); |
|---|
| 26 |
|
|---|
| 27 |
if ($info = get_record('users','ident',$page_owner)) { |
|---|
| 28 |
$url = url; |
|---|
| 29 |
$name = (stripslashes($info->name)); |
|---|
| 30 |
$username = (stripslashes($info->username)); |
|---|
| 31 |
$mainurl = (url . $username . "/files/"); |
|---|
| 32 |
$rssurl = $mainurl . "rss/" . urlencode($tag); |
|---|
| 33 |
$rssdescription = sprintf(gettext("Files 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 : $rssfiles]]></title> |
|---|
| 39 |
<description><![CDATA[$rssdescription]]></description> |
|---|
| 40 |
<link>$mainurl</link> |
|---|
| 41 |
END; |
|---|
| 42 |
$output .= run("files:rss:getitems", array($page_owner, 10, $tag)); |
|---|
| 43 |
$output .= <<< END |
|---|
| 44 |
|
|---|
| 45 |
</channel> |
|---|
| 46 |
</rss> |
|---|
| 47 |
END; |
|---|
| 48 |
} |
|---|
| 49 |
if ($output) { |
|---|
| 50 |
header("Pragma: public"); |
|---|
| 51 |
header("Cache-Control: public"); |
|---|
| 52 |
header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); |
|---|
| 53 |
|
|---|
| 54 |
$if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']); |
|---|
| 55 |
|
|---|
| 56 |
$etag = md5($output); |
|---|
| 57 |
header('ETag: "' . $etag . '"'); |
|---|
| 58 |
|
|---|
| 59 |
if ($if_none_match == $etag) { |
|---|
| 60 |
header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); |
|---|
| 61 |
exit; |
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
header("Content-Length: " . strlen($output)); |
|---|
| 65 |
|
|---|
| 66 |
header("Content-type: text/xml; charset=utf-8"); |
|---|
| 67 |
echo $output; |
|---|
| 68 |
} |
|---|
| 69 |
} |
|---|