Project

General

Profile

1
<?php
2

    
3
// $Id: rss.php 33 2005-09-06 08:19:25Z ryan $
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.database.php');
29
require_once(WB_PATH.'/framework/class.frontend.php');
30
$database = new database();
31
$wb = new frontend();
32
$wb->get_page_details();
33
$wb->get_website_settings();
34

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

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

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

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

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

    
65
// Get news items from database
66

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

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

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

    
89
}
90

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

    
95
?>
(20-20/27)