Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: rss.php 1457 2011-06-25 17:18:50Z Luisehahne $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/rss.php $
15
 * @lastmodified    $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
16
 *
17
 */
18

    
19
// Check that GET values have been supplied
20
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) {
21
	$page_id = $_GET['page_id'];
22
} else {
23
	header('Location: /');
24
	exit(0);
25
}
26
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
27
	$group_id = $_GET['group_id'];
28
	define('GROUP_ID', $group_id);
29
}
30

    
31
// Include WB files
32
require_once('../../config.php');
33
require_once(WB_PATH.'/framework/class.frontend.php');
34
$wb = new frontend();
35
$wb->page_id = $page_id;
36
$wb->get_page_details();
37
$wb->get_website_settings();
38

    
39
//checkout if a charset is defined otherwise use UTF-8
40
if(defined('DEFAULT_CHARSET')) {
41
	$charset=DEFAULT_CHARSET;
42
} else {
43
	$charset='utf-8';
44
}
45

    
46
// Sending XML header
47
header("Content-type: text/xml; charset=$charset" );
48

    
49
// Header info
50
// Required by CSS 2.0
51
echo '<?xml version="1.0" encoding="'.$charset.'"?>';
52
?> 
53
<rss version="2.0">
54
	<channel>
55
		<title><?php echo PAGE_TITLE; ?></title>
56
		<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link>
57
		<description> <?php echo PAGE_DESCRIPTION; ?></description>
58
<?php
59
// Optional header info 
60
?>
61
		<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language>
62
		<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright>
63
		<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor>
64
		<webMaster><?php echo SERVER_EMAIL; ?></webMaster>
65
		<category><?php echo WEBSITE_TITLE; ?></category>
66
		<generator>WebsiteBaker Content Management System</generator>
67
<?php
68
// Get news items from database
69
$t = TIME();
70
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")";
71
//Query
72
if(isset($group_id)) {
73
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC";
74
} else {
75
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC";	
76
}
77
$result = $database->query($query);
78

    
79
//Generating the news items
80
while($item = $result->fetchRow()){ ?>
81
		<item>
82
			<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title>
83
			<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description>
84
			<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid>
85
			<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link>
86
		</item>
87
<?php } ?>
88
	</channel>
89
</rss>
(22-22/31)