/
rss.php
61 lines (50 loc) · 1.72 KB
/
rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/*********************************
* GET GLOBAL VARS AND FUNCTIONS *
*********************************/
require_once "global.php";
$sql = "SELECT image_id, ".
" filename, ".
" title, ".
" caption, ".
" thumb_width, ".
" thumb_height ".
"FROM photo_image ".
"ORDER BY date_imported DESC ".
"LIMIT 20 ";
if (!$result = mysql_query($sql)) print_error();
header("Content-Type: application/xml; charset=utf-8");
echo <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
<title>{$rss_title}</title>
<link>{$sappho_path}</link>
<description>{$rss_description}</description>
<language>{$rss_lang}</language>
EOF;
while ($image = mysql_fetch_array($result)) {
$title = outputxml($image['title']);
$url = outputxml($sappho_path.'/image/'.$image['image_id'].'/');
$caption = empty($image['caption']) ? '' : "\n <br /><br />".output($image['caption']);
$description = <<<EOF
<img src="http://{$s3_host}/{$s3_path}a/{$image['filename']}.jpg"
alt="{$image['title']}"
width="{$image['thumb_width']}"
height="{$image['thumb_height']}" />{$caption}
EOF;
$description = outputxml($description);
echo <<<EOF
<item>
<title>{$title}</title>
<link>{$url}</link>
<guid>{$url}</guid>
<description>
{$description}
</description>
</item>
EOF;
};
?>
</channel>
</rss>