Rev 229 Rev 239
1 <?php 1 <?php
2   2  
3 /** 3 /**
4 * RSS 2.0 output for singapore. 4 * RSS 2.0 output for singapore.
5 * 5 *
6 * @author Ross Howard <abitcloser.com 6 * @author Ross Howard <abitcloser.com
7 * @copyright (c)2006 Tamlyn Rhodes 7 * @copyright (c)2006 Tamlyn Rhodes
8 * @version 0.8 8 * @version 0.8
9 */ 9 */
10   10  
11 if(headers_sent()) 11 if(headers_sent())
12 die("ERROR: Unable to send XML content-type header."); 12 die("ERROR: Unable to send XML content-type header.");
13 else 13 else
14 header("Content-type: application/rss+xml; charset=".$sg->character_set); 14 header("Content-type: application/rss+xml; charset=".$sg->character_set);
15   15  
16 echo '<?xml version="1.0" encoding="ISO-8859-1"?>'; ?> 16 echo '<?xml version="1.0" encoding="ISO-8859-1"?>'; ?>
17 <rss version="2.0" 17 <rss version="2.0"
18 xmlns:content="http://purl.org/rss/1.0/modules/content/" 18 xmlns:content="http://purl.org/rss/1.0/modules/content/"
19 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 19 xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20 xmlns:dc="http://purl.org/dc/elements/1.1/"> 20 xmlns:dc="http://purl.org/dc/elements/1.1/">
21 <channel> 21 <channel>
22 <title><?php echo $sg->gallery->name(); ?></title> 22 <title><?php echo $sg->gallery->name(); ?></title>
23 <link><?php echo "http://".$_SERVER['HTTP_HOST'].($sg->config->use_mod_rewrite ? '' : dirname($_SERVER['PHP_SELF']).'/').str_replace("template=rss", "", $sg->gallery->URL()); ?></link> 23 <link><?php echo "http://".$_SERVER['HTTP_HOST'].($sg->config->use_mod_rewrite ? '' : dirname($_SERVER['PHP_SELF']).'/').str_replace("template=rss", "", $sg->gallery->URL()); ?></link>
24 <description><?php echo $sg->gallery->name(); ?> Feed</description> 24 <description><?php echo $sg->gallery->name(); ?> Feed</description>
25 <?php if(($timestamp = @strtotime($sg->gallery->date())) !== false && $timestamp != -1) 25 <?php if(($timestamp = @strtotime($sg->gallery->date())) !== false && $timestamp != -1)
26 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?> 26 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?>
27 <generator>http://www.sgal.org/</generator> 27 <generator>http://www.sgal.org/</generator>
28 <?php if($sg->isAlbumPage()) { ?> 28 <?php if($sg->isAlbumPage()) { ?>
29 <?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?> 29 <?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?>
30 <item> 30 <item>
31 <title><?php echo $sg->gallery->images[$index]->name; ?></title> 31 <title><?php echo $sg->gallery->images[$index]->name; ?></title>
32 <link><?php echo "http://".$_SERVER['HTTP_HOST'].str_replace("?template=rss", "", $sg->gallery->images[$index]->url()); ?></link> 32 <link><?php echo "http://".$_SERVER['HTTP_HOST'].str_replace("?template=rss", "", $sg->gallery->images[$index]->url()); ?></link>
33 <?php if(($timestamp = @strtotime($sg->gallery->images[$index]->date())) !== false && $timestamp != -1) 33 <?php if(($timestamp = @strtotime($sg->gallery->images[$index]->date())) !== false && $timestamp != -1)
34 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?> 34 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?>
35 <dc:creator><?php echo $sg->gallery->images[$index]->artist(); ?></dc:creator> 35 <dc:creator><?php echo $sg->gallery->images[$index]->artist(); ?></dc:creator>
36 <description> 36 <description>
37 <![CDATA[ <?php echo $sg->gallery->images[$index]->description(); ?> ]]> 37 <![CDATA[ <?php echo $sg->gallery->images[$index]->description(); ?> ]]>
38 </description> 38 </description>
39 </item> 39 </item>
40 <?php endfor; ?> 40 <?php endfor; ?>
41 <?php } elseif($sg->isGalleryPage()) { ?> 41 <?php } elseif($sg->isGalleryPage()) { ?>
42 <?php for($index = $sg->gallery->startat; $index < $sg->gallery->galleryCountSelected()+$sg->gallery->startat; $index++): ?> 42 <?php for($index = $sg->gallery->startat; $index < $sg->gallery->galleryCountSelected()+$sg->gallery->startat; $index++): ?>
43 <item> 43 <item>
44 <title><![CDATA[<?php echo $sg->gallery->galleries[$index]->name(); ?> ]]></title> 44 <title><![CDATA[<?php echo $sg->gallery->galleries[$index]->name(); ?> ]]></title>
45 <link><?php echo "http://".$_SERVER['HTTP_HOST'].str_replace("?template=rss", "", $sg->gallery->galleries[$index]->url()); ?></link> 45 <link><?php echo "http://".$_SERVER['HTTP_HOST'].str_replace("?template=rss", "", $sg->gallery->galleries[$index]->url()); ?></link>
46 <?php if(($timestamp = @strtotime($sg->gallery->date())) !== false && $timestamp != -1) 46 <?php if(($timestamp = @strtotime($sg->gallery->date())) !== false && $timestamp != -1)
47 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?> 47 echo '<pubDate>'.date('r', $timestamp).'</pubDate>'; ?>
48 <dc:creator><?php echo $sg->gallery->galleries[$index]->artist(); ?></dc:creator> 48 <dc:creator><?php echo $sg->gallery->galleries[$index]->artist(); ?></dc:creator>
49 <description> 49 <description>
50 <![CDATA[ <?php echo $sg->gallery->galleries[$index]->description(); ?>]]> 50 <![CDATA[ <?php echo $sg->gallery->galleries[$index]->description(); ?>]]>
51 </description> 51 </description>
52 </item> 52 </item>
53 <?php endfor; ?> 53 <?php endfor; ?>
54 <?php } ?> 54 <?php } ?>
55 </channel> 55 </channel>
56 </rss> 56 </rss>