Project

General

Profile

1
<?php
2

    
3
// $Id: rss.php 66 2005-09-11 10:19:10Z stefan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
// Include WB files
27
require_once('../../config.php');
28
require_once(WB_PATH.'/framework/class.frontend.php');
29
$database = new database();
30
$wb = new frontend();
31
$wb->get_page_details();
32
$wb->get_website_settings();
33

    
34
// Check that GET values have been supplied
35
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) {
36
	$page_id = $_GET['page_id'];
37
} else {
38
	header('Location: '.WB_URL);
39
}
40
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
41
	$group_id = $_GET['group_id'];
42
}
43

    
44
// Sending XML header
45
header("Content-type: text/xml");
46

    
47
// Header info
48
// Required by CSS 2.0
49

    
50
echo "<rss version='2.0'>";
51
echo "<channel>";
52
echo "<title>".PAGE_TITLE."</title>";
53
echo "<link>".WB_URL."</link>";
54
echo "<description>".PAGE_DESCRIPTION."</description>";
55

    
56
// Optional header info
57
echo "<language>".DEFAULT_LANGUAGE."</language>";
58
echo "<copyright>".WB_URL."</copyright>";
59
echo "<managingEditor>".SERVER_EMAIL."</managingEditor>";
60
echo "<webMaster>".SERVER_EMAIL."</webMaster>";
61
echo "<category>".WEBSITE_TITLE."</category>";
62
echo "<generator>Website Baker Content Management System</generator>";
63

    
64
// Get news items from database
65

    
66
//Query
67
if(isset($group_id)) {
68
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 ORDER BY posted_when DESC";
69
} else {
70
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 ORDER BY posted_when DESC";	
71
}
72
$result = $database->query($query);
73

    
74
//Generating the news items
75
while($item = $result->fetchRow($result)){
76

    
77
    echo "<item>";
78
    echo "<title>".$item["title"]."</title>";
79
    // Stripping HTML Tags for text-only visibility
80
    echo "<description>".strip_tags($item["content_short"])."</description>";
81
    echo "<link>".WB_URL."/pages".$item["link"].PAGE_EXTENSION."</link>";
82
    /* Add further (non required) information here like ie.
83
    echo "<author>".$item["posted_by"]."</author>");
84
    etc.
85
    */
86
    echo "</item>";
87

    
88
}
89

    
90
// Writing footer information
91
echo "</channel>";
92
echo "</rss>";
93

    
94
?>
(20-20/27)