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