Project

General

Profile

1 9 ryan
<?php
2
3
// $Id$
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
// Check that GET values have been supplied
27
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) {
28
	$page_id = $_GET['page_id'];
29 270 ryan
	define('PAGE_ID', $page_id);
30 9 ryan
} else {
31
	header('Location: '.WB_URL);
32
}
33
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
34
	$group_id = $_GET['group_id'];
35 270 ryan
	define('GROUP_ID', $group_id);
36 9 ryan
}
37
38 270 ryan
// Include WB files
39
require_once('../../config.php');
40
require_once(WB_PATH.'/framework/class.frontend.php');
41
$database = new database();
42
$wb = new frontend();
43
$wb->page_id = $page_id;
44
$wb->get_page_details();
45
$wb->get_website_settings();
46
47 9 ryan
// Sending XML header
48
header("Content-type: text/xml");
49
50
// Header info
51
// Required by CSS 2.0
52
53
echo "<rss version='2.0'>";
54
echo "<channel>";
55
echo "<title>".PAGE_TITLE."</title>";
56
echo "<link>".WB_URL."</link>";
57
echo "<description>".PAGE_DESCRIPTION."</description>";
58
59
// Optional header info
60
echo "<language>".DEFAULT_LANGUAGE."</language>";
61
echo "<copyright>".WB_URL."</copyright>";
62
echo "<managingEditor>".SERVER_EMAIL."</managingEditor>";
63
echo "<webMaster>".SERVER_EMAIL."</webMaster>";
64
echo "<category>".WEBSITE_TITLE."</category>";
65
echo "<generator>Website Baker Content Management System</generator>";
66
67
// Get news items from database
68
69
//Query
70
if(isset($group_id)) {
71
	$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";
72
} else {
73
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 ORDER BY posted_when DESC";
74
}
75 32 ryan
$result = $database->query($query);
76 9 ryan
77
//Generating the news items
78 32 ryan
while($item = $result->fetchRow($result)){
79 9 ryan
80
    echo "<item>";
81
    echo "<title>".$item["title"]."</title>";
82
    // Stripping HTML Tags for text-only visibility
83 66 stefan
    echo "<description>".strip_tags($item["content_short"])."</description>";
84 9 ryan
    echo "<link>".WB_URL."/pages".$item["link"].PAGE_EXTENSION."</link>";
85
    /* Add further (non required) information here like ie.
86
    echo "<author>".$item["posted_by"]."</author>");
87
    etc.
88
    */
89
    echo "</item>";
90
91
}
92
93
// Writing footer information
94 31 ryan
echo "</channel>";
95 9 ryan
echo "</rss>";
96
97
?>