Revision 1280
Added by Luisehahne almost 16 years ago
| rss.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2009, 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 |
} else {
|
|
| 30 |
header('Location: /');
|
|
| 31 |
exit(0); |
|
| 32 |
} |
|
| 33 |
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
|
|
| 34 |
$group_id = $_GET['group_id']; |
|
| 35 |
define('GROUP_ID', $group_id);
|
|
| 36 |
} |
|
| 37 |
|
|
| 38 |
// 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 |
//checkout if a charset is defined otherwise use UTF-8 |
|
| 48 |
if(defined('DEFAULT_CHARSET')) {
|
|
| 49 |
$charset=DEFAULT_CHARSET; |
|
| 50 |
} else {
|
|
| 51 |
$charset='utf-8'; |
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
// Sending XML header |
|
| 55 |
header("Content-type: text/xml; charset=$charset" );
|
|
| 56 |
|
|
| 57 |
// Header info |
|
| 58 |
// Required by CSS 2.0 |
|
| 59 |
echo '<?xml version="1.0" encoding="'.$charset.'"?>'; |
|
| 60 |
?> |
|
| 61 |
<rss version="2.0"> |
|
| 62 |
<channel> |
|
| 63 |
<title><?php echo PAGE_TITLE; ?></title> |
|
| 64 |
<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link> |
|
| 65 |
<description> <?php echo PAGE_DESCRIPTION; ?></description> |
|
| 66 |
<?php |
|
| 67 |
// Optional header info |
|
| 68 |
?> |
|
| 69 |
<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language> |
|
| 70 |
<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright>
|
|
| 71 |
<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor> |
|
| 72 |
<webMaster><?php echo SERVER_EMAIL; ?></webMaster> |
|
| 73 |
<category><?php echo WEBSITE_TITLE; ?></category> |
|
| 74 |
<generator>WebsiteBaker Content Management System</generator> |
|
| 75 |
<?php |
|
| 76 |
// Get news items from database |
|
| 77 |
$t = TIME(); |
|
| 78 |
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")"; |
|
| 79 |
//Query |
|
| 80 |
if(isset($group_id)) {
|
|
| 81 |
$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"; |
|
| 82 |
} else {
|
|
| 83 |
$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"; |
|
| 84 |
} |
|
| 85 |
$result = $database->query($query); |
|
| 86 |
|
|
| 87 |
//Generating the news items |
|
| 88 |
while($item = $result->fetchRow()){ ?>
|
|
| 89 |
<item> |
|
| 90 |
<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title> |
|
| 91 |
<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description> |
|
| 92 |
<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid> |
|
| 93 |
<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link> |
|
| 94 |
</item> |
|
| 95 |
<?php } ?> |
|
| 96 |
</channel> |
|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category modules |
|
| 5 |
* @package news |
|
| 6 |
* @author WebsiteBaker Project |
|
| 7 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 8 |
* @copyright 2009-2010, 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 4.3.4 and higher |
|
| 13 |
* @version $Id$ |
|
| 14 |
* @filesource $HeadURL$ |
|
| 15 |
* @lastmodified $Date$ |
|
| 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 |
$database = new database(); |
|
| 35 |
$wb = new frontend(); |
|
| 36 |
$wb->page_id = $page_id; |
|
| 37 |
$wb->get_page_details(); |
|
| 38 |
$wb->get_website_settings(); |
|
| 39 |
|
|
| 40 |
//checkout if a charset is defined otherwise use UTF-8 |
|
| 41 |
if(defined('DEFAULT_CHARSET')) {
|
|
| 42 |
$charset=DEFAULT_CHARSET; |
|
| 43 |
} else {
|
|
| 44 |
$charset='utf-8'; |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
// Sending XML header |
|
| 48 |
header("Content-type: text/xml; charset=$charset" );
|
|
| 49 |
|
|
| 50 |
// Header info |
|
| 51 |
// Required by CSS 2.0 |
|
| 52 |
echo '<?xml version="1.0" encoding="'.$charset.'"?>'; |
|
| 53 |
?> |
|
| 54 |
<rss version="2.0"> |
|
| 55 |
<channel> |
|
| 56 |
<title><?php echo PAGE_TITLE; ?></title> |
|
| 57 |
<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link> |
|
| 58 |
<description> <?php echo PAGE_DESCRIPTION; ?></description> |
|
| 59 |
<?php |
|
| 60 |
// Optional header info |
|
| 61 |
?> |
|
| 62 |
<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language> |
|
| 63 |
<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright>
|
|
| 64 |
<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor> |
|
| 65 |
<webMaster><?php echo SERVER_EMAIL; ?></webMaster> |
|
| 66 |
<category><?php echo WEBSITE_TITLE; ?></category> |
|
| 67 |
<generator>WebsiteBaker Content Management System</generator> |
|
| 68 |
<?php |
|
| 69 |
// Get news items from database |
|
| 70 |
$t = TIME(); |
|
| 71 |
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")"; |
|
| 72 |
//Query |
|
| 73 |
if(isset($group_id)) {
|
|
| 74 |
$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"; |
|
| 75 |
} else {
|
|
| 76 |
$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"; |
|
| 77 |
} |
|
| 78 |
$result = $database->query($query); |
|
| 79 |
|
|
| 80 |
//Generating the news items |
|
| 81 |
while($item = $result->fetchRow()){ ?>
|
|
| 82 |
<item> |
|
| 83 |
<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title> |
|
| 84 |
<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description> |
|
| 85 |
<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid> |
|
| 86 |
<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link> |
|
| 87 |
</item> |
|
| 88 |
<?php } ?> |
|
| 89 |
</channel> |
|
| 97 | 90 |
</rss> |
| 98 | 91 | |
Also available in: Unified diff
continue update headertext